diff options
-rw-r--r-- | include/test/bootstrapfixture.hxx | 1 | ||||
-rw-r--r-- | sd/qa/unit/PNGExportTests.cxx | 10 | ||||
-rw-r--r-- | test/source/bootstrapfixture.cxx | 6 |
3 files changed, 15 insertions, 2 deletions
diff --git a/include/test/bootstrapfixture.hxx b/include/test/bootstrapfixture.hxx index b3463ae223d5..438bba58a431 100644 --- a/include/test/bootstrapfixture.hxx +++ b/include/test/bootstrapfixture.hxx @@ -53,6 +53,7 @@ protected: // until a proper fix is implemented that either considers the DPI properly in the test, or // makes the invariants that test uses independent of DPI. static bool IsDefaultDPI(); + static std::pair<double, double> getDPIScaling(); public: DECL_DLLPRIVATE_STATIC_LINK(BootstrapFixture, ImplInitFilterHdl, ConvertData&, bool); diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index f3ab40228953..44a282f94a97 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -83,7 +83,11 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) // make sure only the shape is exported Size aSize = aBMPEx.GetSizePixel(); - CPPUNIT_ASSERT_EQUAL(Size(193, 193), aSize); + const auto[scalingX, scalingY] = getDPIScaling(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(193 * scalingX, aSize.getWidth(), 1.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(193 * scalingY, aSize.getHeight(), 1.0); + if (!IsDefaultDPI()) + return; // Check all borders are red // use assertColorsAreSimilar since the color might differ a little bit on mac @@ -144,7 +148,9 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) // make sure only the shape is exported Size aSize = aBMPEx.GetSizePixel(); - CPPUNIT_ASSERT_EQUAL(Size(295, 134), aSize); + const auto[scalingX, scalingY] = getDPIScaling(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(295 * scalingX, aSize.getWidth(), 1.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(134 * scalingY, aSize.getHeight(), 1.0); // Check all borders are red or similar. Ignore the corners Bitmap aBMP = aBMPEx.GetBitmap(); diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index 4d933a3fc5d2..c13caf807d1e 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -264,6 +264,12 @@ bool test::BootstrapFixture::IsDefaultDPI() && Application::GetDefaultDevice()->GetDPIY() == 96); } +std::pair<double, double> test::BootstrapFixture::getDPIScaling() +{ + return { Application::GetDefaultDevice()->GetDPIX() / 96.0, + Application::GetDefaultDevice()->GetDPIY() / 96.0 }; +} + sal_uInt16 test::BootstrapFixture::getDefaultDeviceBitCount() { ScopedVclPtr<VirtualDevice> device |