summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-02 16:38:23 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-02 16:38:23 +0000
commit97e11c790fe074bd6201a7f392bfc964bd471d02 (patch)
tree9e87843f7fd25d9721b3b2b3ef4d1e4e214595fb
parent499303c2bc43cdea0de99db51f589db6bd5e8e00 (diff)
A few more libpbd test tweaks.
git-svn-id: svn://localhost/ardour2/branches/3.0@6839 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/pbd/test/scalar_properties.cc26
-rw-r--r--libs/pbd/test/scalar_properties.h2
-rwxr-xr-xlibs/pbd/test/testrunner.cc3
3 files changed, 29 insertions, 2 deletions
diff --git a/libs/pbd/test/scalar_properties.cc b/libs/pbd/test/scalar_properties.cc
index 05d97a7ad1..eff640c6d1 100644
--- a/libs/pbd/test/scalar_properties.cc
+++ b/libs/pbd/test/scalar_properties.cc
@@ -1,26 +1,37 @@
#include "scalar_properties.h"
+CPPUNIT_TEST_SUITE_REGISTRATION (ScalarPropertiesTest);
+
+using namespace std;
using namespace PBD;
namespace Properties {
PBD::PropertyDescriptor<int> fred;
};
+void
+ScalarPropertiesTest::make_property_quarks ()
+{
+ Properties::fred.property_id = g_quark_from_static_string ("fred");
+}
+
ScalarPropertiesTest::ScalarPropertiesTest ()
: _fred (Properties::fred, 0)
{
-
}
void
ScalarPropertiesTest::testBasic ()
{
CPPUNIT_ASSERT (_fred.changed() == false);
-
+
_fred = 4;
CPPUNIT_ASSERT (_fred == 4);
CPPUNIT_ASSERT (_fred.changed() == true);
+ _fred.clear_history ();
+ CPPUNIT_ASSERT (_fred.changed() == false);
+
_fred = 5;
CPPUNIT_ASSERT (_fred == 5);
CPPUNIT_ASSERT (_fred.changed() == true);
@@ -28,4 +39,15 @@ ScalarPropertiesTest::testBasic ()
PropertyList undo;
PropertyList redo;
_fred.diff (undo, redo);
+
+ CPPUNIT_ASSERT (undo.size() == 1);
+ CPPUNIT_ASSERT (redo.size() == 1);
+
+ PropertyTemplate<int>* t = dynamic_cast<Property<int>*> (undo.begin()->second);
+ CPPUNIT_ASSERT (t);
+ CPPUNIT_ASSERT (t->val() == 4);
+
+ t = dynamic_cast<Property<int>*> (redo.begin()->second);
+ CPPUNIT_ASSERT (t);
+ CPPUNIT_ASSERT (t->val() == 5);
}
diff --git a/libs/pbd/test/scalar_properties.h b/libs/pbd/test/scalar_properties.h
index 04291e66e9..6175aeacfe 100644
--- a/libs/pbd/test/scalar_properties.h
+++ b/libs/pbd/test/scalar_properties.h
@@ -12,6 +12,8 @@ public:
ScalarPropertiesTest ();
void testBasic ();
+ static void make_property_quarks ();
+
private:
PBD::Property<int> _fred;
};
diff --git a/libs/pbd/test/testrunner.cc b/libs/pbd/test/testrunner.cc
index 7c4d893221..1512ebd024 100755
--- a/libs/pbd/test/testrunner.cc
+++ b/libs/pbd/test/testrunner.cc
@@ -4,10 +4,13 @@
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
+#include "scalar_properties.h"
int
main ()
{
+ ScalarPropertiesTest::make_property_quarks ();
+
CppUnit::TestResult testresult;
CppUnit::TestResultCollector collectedresults;