]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/geometry/rect.cpp
using ordinary Show for popup windows as on MSW which activates it as well, I'll...
[wxWidgets.git] / tests / geometry / rect.cpp
index cb196373ce1fb33c5559e2063f87f289a3e3f479..c90197e9f440da53a4e670586598a3ca0da719b1 100644 (file)
@@ -28,7 +28,7 @@
 // ----------------------------------------------------------------------------
 
 // this operator is needed to use CPPUNIT_ASSERT_EQUAL with wxRects
-wxSTD ostream& operator<<(wxSTD ostream& os, const wxRect& r)
+std::ostream& operator<<(std::ostream& os, const wxRect& r)
 {
     os << "{"
         << r.x << ", " << r.y << ", " << r.width << ", " << r.height
@@ -64,7 +64,7 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( RectTestCase );
 
-// also include in it's own registry so that these tests can be run alone
+// also include in its own registry so that these tests can be run alone
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( RectTestCase, "RectTestCase" );
 
 void RectTestCase::CentreIn()
@@ -129,6 +129,14 @@ void RectTestCase::Operators()
             ( data.GetSecond() + data.GetFirst() ) == data.GetResult()
         );
     }
+
+    // test operator*() which returns the intersection of two rectangles
+    wxRect r1 = wxRect(0, 2, 3, 4);
+    wxRect r2 = wxRect(1, 2, 7, 8);
+    r1 *= r2;
+    CPPUNIT_ASSERT(wxRect(1, 2, 2, 4) == r1);
+
+    CPPUNIT_ASSERT( (r1 * wxRect()).IsEmpty() );
 }
 
 void RectTestCase::Union()