sd/qa/unit/import-tests.cxx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
New commits: commit 441e79dc9e7a1ef8db30ed6a8dc0a5872ff3bf4b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Tue Jun 7 18:07:43 2016 +0900 sd: make test "testTdf93124" more robust Check that the bitmap ihas been exported and imported correctly instead of seg. fault. + use ScopedReadAccess Change-Id: Ib79b5beddef5dc4f7c3435bae94c2f6a26f8ac10 (cherry picked from commit f08e1630ae56e6f3335a11020e6d2c33c4ce2863) Reviewed-on: https://gerrit.libreoffice.org/32692 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index b639c19..0defbc4 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1310,18 +1310,25 @@ void SdImportTest::testTdf93124() SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); vcl::PNGReader aPNGReader(aFileStream); BitmapEx aBMPEx = aPNGReader.Read(); + + // make sure the bitmap is not empty and correct size (PNG export->import was successful) + CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMPEx.GetSizePixel()); Bitmap aBMP = aBMPEx.GetBitmap(); - BitmapReadAccess* pRead = aBMP.AcquireReadAccess(); - int nNonWhiteCount = 0; - // The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white. - for (long nX = 34; nX < (34 + 43); ++nX) + { + Bitmap::ScopedReadAccess pReadAccess(aBMP); + int nNonWhiteCount = 0; + // The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white. for (long nY = 4; nY < (4 + 26); ++nY) { - const Color aColor = pRead->GetColor(nY, nX); - if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff)) - ++nNonWhiteCount; + for (long nX = 34; nX < (34 + 43); ++nX) + { + const Color aColor = pReadAccess->GetColor(nY, nX); + if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff)) + ++nNonWhiteCount; + } } - CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount>100); + CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount>100); + } xDocShRef->DoClose(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits