1 #include <simgear/compiler.h>
3 #include "CSSBorder.hxx"
8 #define COMPARE(a, b) \
9 if( std::fabs((a) - (b)) > 1e-4 ) \
11 std::cerr << "line " << __LINE__ << ": failed: "\
12 << #a << " != " << #b << " d = " << ((a) - (b)) << std::endl; \
19 std::cerr << "line " << __LINE__ << ": failed: "\
24 using namespace simgear;
26 int main (int ac, char ** av)
28 CSSBorder b = CSSBorder::parse("5");
31 CSSBorder::Offsets o = b.getAbsOffsets(SGRect<int>());
37 b = CSSBorder::parse("5 10");
38 o = b.getAbsOffsets(SGRect<int>());
44 b = CSSBorder::parse("5 10 15");
45 o = b.getAbsOffsets(SGRect<int>());
51 b = CSSBorder::parse("5 10 15 20");
52 o = b.getAbsOffsets(SGRect<int>());
58 b = CSSBorder::parse("5 10 15 20");
59 o = b.getRelOffsets(SGRect<int>(0,0,100,200));
65 b = CSSBorder::parse("5% 10% 15% 20%");
66 o = b.getAbsOffsets(SGRect<int>(0,0,100,200));
72 o = b.getRelOffsets(SGRect<int>(0,0,100,200));
78 b = CSSBorder::parse("5% none");
79 o = b.getAbsOffsets(SGRect<int>(0,0,200,200));
84 VERIFY(b.getKeyword().empty());
87 b = CSSBorder::parse("none");
88 o = b.getRelOffsets(SGRect<int>(0,0,200,200));
93 VERIFY(b.getKeyword().empty());
97 VERIFY(!b2.isValid());
98 o = b.getAbsOffsets(SGRect<int>(0,0,200,200));
103 o = b.getRelOffsets(SGRect<int>(0,0,200,200));
109 std::cout << "all tests passed successfully!" << std::endl;