source: trunk/test/src/RpBoolean_test.cc @ 114

Last change on this file since 114 was 40, checked in by dkearney, 19 years ago

initial add for test directory which will hold test cases for using rappture

File size: 2.2 KB
Line 
1#include "RpBoolean.h"
2
3int test_setPath(RpBoolean* myBoolean);
4int test_setDefaultValue(RpBoolean* myBoolean);
5int test_setCurrentValue(RpBoolean* myBoolean);
6int test_setLabel(RpBoolean* myBoolean);
7int test_setDesc(RpBoolean* myBoolean);
8
9int test_setPath(RpBoolean* myBoolean)
10{
11    std::cout << "Path " << myBoolean->getPath() << std::endl;
12    myBoolean->setPath("input.(ambiant)");
13    std::cout << "Path " << myBoolean->getPath() << std::endl;
14
15    return 1;
16}
17
18
19int test_setDefaultValue(RpBoolean* myBoolean)
20{
21    std::cout << "defaultVal " << myBoolean->getDefaultValue() << std::endl;
22    myBoolean->setDefaultValue("new default value");
23    std::cout << "defaultVal " << myBoolean->getDefaultValue() << std::endl;
24
25    return 1;
26}
27
28int test_setCurrentValue(RpBoolean* myBoolean)
29{
30    std::cout << "currentVal " << myBoolean->getCurrentValue() << std::endl;
31    myBoolean->setCurrentValue("new current value");
32    std::cout << "currentVal " << myBoolean->getCurrentValue() << std::endl;
33
34    return 1;
35}
36
37int test_setLabel(RpBoolean* myBoolean)
38{
39    std::cout << "label " << myBoolean->getLabel() << std::endl;
40    myBoolean->setLabel("newLabel");
41    std::cout << "label " << myBoolean->getLabel() << std::endl;
42
43    return 1;
44}
45
46int test_setDesc(RpBoolean* myBoolean)
47{
48    std::cout << "desc " << myBoolean->getDesc() << std::endl;
49    myBoolean->setDesc("new description");
50    std::cout << "desc " << myBoolean->getDesc() << std::endl;
51
52    return 1;
53}
54
55int main ()
56{
57
58    RpBoolean* T1 = new RpBoolean("input.(ambient).(temperature)","default-string");
59    RpBoolean* T2 = new RpBoolean("input.(ambient).(temperature)",
60                                "default-string",
61                                "boolean2's label",
62                                "boolean2's desc"
63                                );
64   
65
66    std::cout << "T1 run" << std::endl;
67    test_setPath(T1);
68    test_setDefaultValue(T1);
69    test_setCurrentValue(T1);
70    test_setLabel(T1);
71    test_setDesc(T1);
72
73    std::cout << std::endl;
74
75    std::cout << "T2 run" << std::endl;
76    test_setPath(T2);
77    test_setDefaultValue(T2);
78    test_setCurrentValue(T2);
79    test_setLabel(T2);
80    test_setDesc(T2);
81
82    std::cout << std::endl;
83    std::cout << std::endl;
84
85    return 0;
86}
Note: See TracBrowser for help on using the repository browser.