aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorMax Horn2009-04-09 17:08:09 +0000
committerMax Horn2009-04-09 17:08:09 +0000
commita1dc2ecc6342f77a4c663057ce00c388092124f2 (patch)
tree5b55866fe48f79cb14d1242949bd7473f9f99643 /test/common
parentc473fa849d7539444c1810ce48cb83dec31a7916 (diff)
downloadscummvm-rg350-a1dc2ecc6342f77a4c663057ce00c388092124f2.tar.gz
scummvm-rg350-a1dc2ecc6342f77a4c663057ce00c388092124f2.tar.bz2
scummvm-rg350-a1dc2ecc6342f77a4c663057ce00c388092124f2.zip
Rewrote Common::Rect::contains(Rect) to do what the name suggests (check whether one rect contains the other). Previously, foo.contains(foo) would return false. Added/enabled unit tets for this
svn-id: r39911
Diffstat (limited to 'test/common')
-rw-r--r--test/common/rect.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/common/rect.h b/test/common/rect.h
index 07353f7aea..ee709de482 100644
--- a/test/common/rect.h
+++ b/test/common/rect.h
@@ -26,6 +26,24 @@ class RectTestSuite : public CxxTest::TestSuite
TS_ASSERT( !Common::Rect(0, 0, 1, 1).intersects(Common::Rect(1, 1, 2, 2)) );
}
+ void test_contains( void )
+ {
+ Common::Rect r0;
+ Common::Rect r1(0, 0, 1, 1);
+ Common::Rect r2(0, 0, 2, 2);
+ TS_ASSERT( !r0.contains(r1) );
+ TS_ASSERT( !r0.contains(r2) );
+ TS_ASSERT( !r1.contains(r2) );
+ TS_ASSERT( r0.contains(r0) );
+
+ TS_ASSERT( r1.contains(r0) );
+ TS_ASSERT( r1.contains(r1) );
+
+ TS_ASSERT( r2.contains(r0) );
+ TS_ASSERT( r2.contains(r1) );
+ TS_ASSERT( r2.contains(r2) );
+ }
+
void test_extend( void )
{
Common::Rect r0;
@@ -33,7 +51,7 @@ class RectTestSuite : public CxxTest::TestSuite
Common::Rect r2(0, 0, 2, 2);
TS_ASSERT( !r0.contains(r1) );
r0.extend(r1);
-// TS_ASSERT( r0.contains(r1) );
+ TS_ASSERT( r0.contains(r1) );
TS_ASSERT_EQUALS(r0.top, 0);
TS_ASSERT_EQUALS(r0.left, 0);
TS_ASSERT_EQUALS(r0.bottom, 1);