From 2d096311c58115d9727f26be513e53e0aaeb65f1 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 5 Jul 2016 21:23:04 +0200 Subject: [PATCH] Fixed clipping box tests for Direct2D Flushing native Direct2D renderer (invoking wxGCDC::Flush() -> wxGraphicsContext::Flush() -> ID2D1RenderTarget::Flush()) is apparently not enough to update underlying DC (with selected in bitmap) and therefore we have to destroy the renderer (which in turn invokes ID2D1RenderTarget::EndDraw()) to do so. --- tests/graphics/clippingbox.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/graphics/clippingbox.cpp b/tests/graphics/clippingbox.cpp index 864f52c153..3cd9cf58a0 100644 --- a/tests/graphics/clippingbox.cpp +++ b/tests/graphics/clippingbox.cpp @@ -246,6 +246,16 @@ public: virtual ~ClippingBoxTestCaseDirect2D() {} + virtual void FlushDC() + { + // Apparently, flushing native Direct2D renderer + // is not enough to update underlying DC (bitmap) + // and therefore we have to destroy the renderer + // to do so. + ClippingBoxTestCaseGCDC::FlushDC(); + m_gcdc->SetGraphicsContext(NULL); + } + private: CPPUNIT_TEST_SUITE( ClippingBoxTestCaseDirect2D ); CPPUNIT_TEST( InitialState ); @@ -323,9 +333,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ClippingBoxTestCaseCairo, "ClippingBoxTes void ClippingBoxTestCaseBase::CheckBox(int x, int y, int width, int height) { - // Update wxDC contents. - FlushDC(); - // Check clipping box boundaries. int clipX, clipY, clipW, clipH; m_dc->GetClippingBox(&clipX, &clipY, &clipW, &clipH); @@ -360,6 +367,9 @@ void ClippingBoxTestCaseBase::CheckBox(int x, int y, int width, int height) msg = msgDim; } + // Update wxDC contents. + FlushDC(); + // Check whether diagonal corners of the clipping box // are actually drawn at the edge of the clipping region. #if wxUSE_IMAGE