integrated changes for 1.2.3

This commit is contained in:
Guenter Obiltschnig
2006-09-14 16:48:30 +00:00
parent a01116ca11
commit 245e2f7e83
6 changed files with 53 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
//
// NotificationCenterTest.cpp
//
// $Id: //poco/1.2/Foundation/testsuite/src/NotificationCenterTest.cpp#1 $
// $Id: //poco/1.2/Foundation/testsuite/src/NotificationCenterTest.cpp#2 $
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -35,11 +35,13 @@
#include "CppUnit/TestSuite.h"
#include "Poco/NotificationCenter.h"
#include "Poco/Observer.h"
#include "Poco/NObserver.h"
#include "Poco/AutoPtr.h"
using Poco::NotificationCenter;
using Poco::Observer;
using Poco::NObserver;
using Poco::Notification;
using Poco::AutoPtr;
@@ -131,6 +133,17 @@ void NotificationCenterTest::test5()
}
void NotificationCenterTest::testAuto()
{
NotificationCenter nc;
nc.addObserver(NObserver<NotificationCenterTest, Notification>(*this, &NotificationCenterTest::handleAuto));
nc.postNotification(new Notification);
assert (_set.size() == 1);
assert (_set.find("handleAuto") != _set.end());
nc.removeObserver(NObserver<NotificationCenterTest, Notification>(*this, &NotificationCenterTest::handleAuto));
}
void NotificationCenterTest::testDefaultCenter()
{
NotificationCenter& nc = NotificationCenter::defaultCenter();
@@ -174,6 +187,12 @@ void NotificationCenterTest::handleTest(TestNotification* pNf)
}
void NotificationCenterTest::handleAuto(const AutoPtr<Notification>& pNf)
{
_set.insert("handleAuto");
}
void NotificationCenterTest::setUp()
{
_set.clear();
@@ -194,6 +213,7 @@ CppUnit::Test* NotificationCenterTest::suite()
CppUnit_addTest(pSuite, NotificationCenterTest, test3);
CppUnit_addTest(pSuite, NotificationCenterTest, test4);
CppUnit_addTest(pSuite, NotificationCenterTest, test5);
CppUnit_addTest(pSuite, NotificationCenterTest, testAuto);
CppUnit_addTest(pSuite, NotificationCenterTest, testDefaultCenter);
return pSuite;

View File

@@ -1,7 +1,7 @@
//
// NotificationCenterTest.h
//
// $Id: //poco/1.2/Foundation/testsuite/src/NotificationCenterTest.h#1 $
// $Id: //poco/1.2/Foundation/testsuite/src/NotificationCenterTest.h#2 $
//
// Definition of the NotificationCenterTest class.
//
@@ -39,6 +39,7 @@
#include "Poco/Foundation.h"
#include "CppUnit/TestCase.h"
#include "Poco/Notification.h"
#include "Poco/AutoPtr.h"
#include <set>
@@ -56,6 +57,7 @@ public:
void test3();
void test4();
void test5();
void testAuto();
void testDefaultCenter();
void setUp();
@@ -68,6 +70,7 @@ protected:
void handle2(Poco::Notification* pNf);
void handle3(Poco::Notification* pNf);
void handleTest(TestNotification* pNf);
void handleAuto(const Poco::AutoPtr<Poco::Notification>& pNf);
private:
std::set<std::string> _set;