blob: 3586fc3a957bb7a30244c96aa9e2bb1b33ebfe30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#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_changes ();
CPPUNIT_ASSERT (_fred.changed() == false);
_fred = 5;
CPPUNIT_ASSERT (_fred == 5);
CPPUNIT_ASSERT (_fred.changed() == true);
PropertyList changes;
_fred.get_changes_as_properties (changes, 0);
CPPUNIT_ASSERT (changes.size() == 1);
PropertyTemplate<int>* t = dynamic_cast<Property<int>*> (changes.begin()->second);
CPPUNIT_ASSERT (t);
CPPUNIT_ASSERT (t->val() == 5);
}
|