NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / pbd / test / scalar_properties.cc
1 #include "scalar_properties.h"
2
3 CPPUNIT_TEST_SUITE_REGISTRATION (ScalarPropertiesTest);
4
5 using namespace std;
6 using namespace PBD;
7
8 namespace Properties {
9         PBD::PropertyDescriptor<int> fred;
10 };
11
12 void
13 ScalarPropertiesTest::make_property_quarks ()
14 {
15         Properties::fred.property_id = g_quark_from_static_string ("fred");
16 }
17
18 ScalarPropertiesTest::ScalarPropertiesTest ()
19         : _fred (Properties::fred, 0)
20 {
21 }
22
23 void
24 ScalarPropertiesTest::testBasic ()
25 {
26         CPPUNIT_ASSERT (_fred.changed() == false);
27
28         _fred = 4;
29         CPPUNIT_ASSERT (_fred == 4);
30         CPPUNIT_ASSERT (_fred.changed() == true);
31
32         _fred.clear_changes ();
33         CPPUNIT_ASSERT (_fred.changed() == false);
34
35         _fred = 5;
36         CPPUNIT_ASSERT (_fred == 5);
37         CPPUNIT_ASSERT (_fred.changed() == true);
38
39         PropertyList changes;
40         _fred.get_changes_as_properties (changes, 0);
41
42         CPPUNIT_ASSERT (changes.size() == 1);
43
44         PropertyTemplate<int>* t = dynamic_cast<Property<int>*> (changes.begin()->second);
45         CPPUNIT_ASSERT (t);
46         CPPUNIT_ASSERT (t->val() == 5);
47 }