From ecaeceb8783bde48228802958c0f9a91e6f27bb2 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 16 Sep 2016 22:27:13 +0200 Subject: [PATCH] Add few tests of retrieving bounding box New tests of retrieving bounding box coordinates after two consecutive drawing operations, for the case when wxDC coordinates have been changed between the operations and for resetting the bounding box. See #17667. --- tests/graphics/boundingbox.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/graphics/boundingbox.cpp b/tests/graphics/boundingbox.cpp index 5d3e1cba1e..a3c1a7ec0b 100644 --- a/tests/graphics/boundingbox.cpp +++ b/tests/graphics/boundingbox.cpp @@ -100,7 +100,10 @@ private: CPPUNIT_TEST( DrawPolygon ); CPPUNIT_TEST( DrawPolyPolygon ); CPPUNIT_TEST( DrawRectangle ); + CPPUNIT_TEST( DrawTwoRectangles ); + CPPUNIT_TEST( DrawRectsOnTransformedDC ); CPPUNIT_TEST( DrawRoundedRectangle ); + CPPUNIT_TEST( DrawRectangleAndReset ); CPPUNIT_TEST( DrawEllipse ); CPPUNIT_TEST( Blit ); CPPUNIT_TEST( StretchBlit ); @@ -125,7 +128,10 @@ private: void DrawPolygon(); void DrawPolyPolygon(); void DrawRectangle(); + void DrawTwoRectangles(); + void DrawRectsOnTransformedDC(); void DrawRoundedRectangle(); + void DrawRectangleAndReset(); void DrawEllipse(); void Blit(); void StretchBlit(); @@ -332,3 +338,26 @@ void GCDCBoundingBoxTestCase::DrawCheckMark() m_gcdc->DrawCheckMark(32, 24, 16, 16); AssertBox(32, 24, 16, 16); } + +void GCDCBoundingBoxTestCase::DrawRectangleAndReset() +{ + m_gcdc->DrawRectangle(2, 2, 12, 12); + m_gcdc->ResetBoundingBox(); + AssertBox(0, 0, 0, 0); +} + +void GCDCBoundingBoxTestCase::DrawTwoRectangles() +{ + m_gcdc->DrawRectangle(10, 15, 50, 30); + m_gcdc->DrawRectangle(15, 20, 55, 35); + AssertBox(10, 15, 60, 40); +} + +void GCDCBoundingBoxTestCase::DrawRectsOnTransformedDC() +{ + m_gcdc->DrawRectangle(10, 15, 50, 30); + m_gcdc->SetDeviceOrigin(15, 20); + m_gcdc->DrawRectangle(15, 20, 45, 35); + m_gcdc->SetDeviceOrigin(5, 10); + AssertBox(5, 5, 65, 60); +}