diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-05-13 22:32:32 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-14 15:53:06 +0100 |
commit | 1d4bbe7b305558faf86aa083cc50d71a7804ef7d (patch) | |
tree | 287bbd0a100391087f1766d11fab022b2b1e573b /vcl/qa/cppunit | |
parent | d97732f635c0583fbeea5706399ba9197903dc83 (diff) |
vcl: attempt to fix high quality scaling to get aspect ratio right.
Change-Id: Ic62c6a16c39dd4e4e19bf9a96503ecf6ac50f292
Diffstat (limited to 'vcl/qa/cppunit')
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/filters-test.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 23f297854182..7d73e2c9af30 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -38,8 +38,12 @@ public: */ void testCVEs(); + /// test scaling + void testScaling(); + CPPUNIT_TEST_SUITE(VclFiltersTest); CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST(testScaling); CPPUNIT_TEST_SUITE_END(); }; @@ -53,6 +57,22 @@ bool VclFiltersTest::load(const OUString &, return aGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == 0; } +void VclFiltersTest::testScaling() +{ + for (unsigned int i = BMP_SCALE_FAST; i <= BMP_SCALE_BOX; i++) + { + Bitmap aBitmap( Size( 413, 409 ), 24 ); + BitmapEx aBitmapEx( aBitmap ); + + fprintf( stderr, "scale with type %d\n", i ); + CPPUNIT_ASSERT( aBitmapEx.Scale( 0.1937046, 0.193154, i ) ); + Size aAfter( aBitmapEx.GetSizePixel() ); + fprintf( stderr, "size %ld, %ld\n", (long)aAfter.Width(), + aAfter.Height() ); + CPPUNIT_ASSERT( labs (aAfter.Height() - aAfter.Width()) <= 1 ); + } +} + void VclFiltersTest::testCVEs() { #ifndef DISABLE_CVE_TESTS |