vcl/qa/cppunit/animationrenderer.cxx | 45 +++++++++++------------------------ 1 file changed, 15 insertions(+), 30 deletions(-)
New commits: commit 6d423ed9bb89da15bfd9ac3555cb01696458fa71 Author: offtkp <parisop...@gmail.com> AuthorDate: Sun Oct 29 13:12:02 2023 +0200 Commit: Paris Oplopoios <parisop...@gmail.com> CommitDate: Sun Oct 29 22:18:05 2023 +0100 CppunitTest_vcl_animate: use CPPUNIT_TEST_FIXTURE CPPUNIT_TEST_FIXTURE is easier to write tests for and separate if needed Change-Id: I2c478205847e4d15c0f8d65d498dd8d82079fa5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158616 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisop...@gmail.com> diff --git a/vcl/qa/cppunit/animationrenderer.cxx b/vcl/qa/cppunit/animationrenderer.cxx index 86ad06c47941..93f80970f2ea 100644 --- a/vcl/qa/cppunit/animationrenderer.cxx +++ b/vcl/qa/cppunit/animationrenderer.cxx @@ -31,6 +31,18 @@ public: void ReleaseGraphics(bool) override {} bool UsePolyPolygonForComplexGradient() override { return false; } }; + +Animation createAnimation() +{ + Animation aAnimation; + + aAnimation.Insert( + AnimationFrame(BitmapEx(Size(3, 4), vcl::PixelFormat::N24_BPP), Point(0, 0), Size(10, 10))); + aAnimation.Insert( + AnimationFrame(BitmapEx(Size(3, 3), vcl::PixelFormat::N24_BPP), Point(0, 0), Size(10, 10))); + + return aAnimation; +} } class VclAnimationRendererTest : public test::BootstrapFixture @@ -40,22 +52,9 @@ public: : BootstrapFixture(true, false) { } - - void testMatching(); - void testDrawToPos(); - void testGetPosSizeWindow(); - - CPPUNIT_TEST_SUITE(VclAnimationRendererTest); - CPPUNIT_TEST(testMatching); - CPPUNIT_TEST(testDrawToPos); - CPPUNIT_TEST(testGetPosSizeWindow); - CPPUNIT_TEST_SUITE_END(); - -private: - Animation createAnimation(); }; -void VclAnimationRendererTest::testMatching() +CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testMatching) { Animation aTestAnim = createAnimation(); ScopedVclPtrInstance<TestRenderingContext> pTestRC; @@ -69,7 +68,7 @@ void VclAnimationRendererTest::testMatching() CPPUNIT_ASSERT(pAnimationRenderer->matches(pTestRC, 0)); } -void VclAnimationRendererTest::testDrawToPos() +CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testDrawToPos) { Animation aTestAnim = createAnimation(); ScopedVclPtrInstance<VirtualDevice> pTestRC; @@ -84,7 +83,7 @@ void VclAnimationRendererTest::testDrawToPos() CPPUNIT_ASSERT_EQUAL(Size(1, 1), pTestRC->GetOutputSizePixel()); } -void VclAnimationRendererTest::testGetPosSizeWindow() +CPPUNIT_TEST_FIXTURE(VclAnimationRendererTest, testGetPosSizeWindow) { Animation aTestAnim = createAnimation(); ScopedVclPtrInstance<TestRenderingContext> pTestRC; @@ -102,20 +101,6 @@ void VclAnimationRendererTest::testGetPosSizeWindow() CPPUNIT_ASSERT_EQUAL(Size(10, 10), aSize); } -Animation VclAnimationRendererTest::createAnimation() -{ - Animation aAnimation; - - aAnimation.Insert( - AnimationFrame(BitmapEx(Size(3, 4), vcl::PixelFormat::N24_BPP), Point(0, 0), Size(10, 10))); - aAnimation.Insert( - AnimationFrame(BitmapEx(Size(3, 3), vcl::PixelFormat::N24_BPP), Point(0, 0), Size(10, 10))); - - return aAnimation; -} - -CPPUNIT_TEST_SUITE_REGISTRATION(VclAnimationRendererTest); - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */