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.getAbsOffsets(SGRect<int>(0,0,200,200));
65 o = b.getRelOffsets(SGRect<int>(0,0,200,200));
71 b = CSSBorder::parse("5% none");
72 o = b.getAbsOffsets(SGRect<int>(0,0,200,200));
77 VERIFY(b.getKeyword().empty());
80 b = CSSBorder::parse("none");
81 o = b.getRelOffsets(SGRect<int>(0,0,200,200));
86 VERIFY(b.getKeyword().empty());
90 VERIFY(!b2.isValid());
91 o = b.getAbsOffsets(SGRect<int>(0,0,200,200));
96 o = b.getRelOffsets(SGRect<int>(0,0,200,200));
102 std::cout << "all tests passed successfully!" << std::endl;