desktop/source/app/app.cxx | 15 include/unotools/VersionConfig.hxx | 45 + include/vcl/test/GraphicsRenderTests.hxx | 92 +++ include/vcl/test/TestResult.hxx | 26 sfx2/source/view/viewfrm.cxx | 12 vcl/Library_vcl.mk | 1 vcl/backendtest/GraphicsRenderTests.cxx | 914 +++++++++++++++++++++++++++++++ vcl/inc/test/outputdevice.hxx | 13 8 files changed, 1096 insertions(+), 22 deletions(-)
New commits: commit 07e269f2596756bf841bbc380929bcffc3ca6bc6 Author: homeboy445 <akshitsa...@gmail.com> AuthorDate: Mon Jun 7 15:52:34 2021 +0530 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Jun 18 07:22:49 2021 +0200 VCL graphics rendering tests that a run on LO version change This commit includes the implementation of graphics rendering tests which would be automatically triggered at first installation or upgrades of LibreOffice. These tests check the graphic rendering interface of LibreOffice by drawing and checking various graphical rendering tools (eg:. by drawing lines, polygons etc.). After the successful completion of tests, their results are stored in the user folder for future reference. Change-Id: I59c94b57a1f3f3a9cba55af1067a9702b6da98d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116779 Tested-by: Tomaž Vajngerl <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index b0c4fac53e10..42a687b69088 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -99,8 +99,10 @@ #include <osl/process.h> #include <rtl/byteseq.hxx> #include <unotools/pathoptions.hxx> +#include <unotools/VersionConfig.hxx> #include <svtools/menuoptions.hxx> #include <rtl/bootstrap.hxx> +#include <vcl/test/GraphicsRenderTests.hxx> #include <vcl/glxtestprocess.hxx> #include <vcl/help.hxx> #include <vcl/weld.hxx> @@ -336,6 +338,16 @@ void RemoveIconCacheDirectory() namespace { +void runGraphicsRenderTests() +{ + if (!utl::isProductVersionUpgraded(false)) + { + return; + } + GraphicsRenderTests TestObject; + TestObject.run(); +} + OUString MakeStartupErrorMessage(std::u16string_view aErrorMessage) { @@ -1550,6 +1562,9 @@ int Desktop::Main() CheckOpenCLCompute(xDesktop); #endif + //Running the VCL graphics rendering tests + runGraphicsRenderTests(); + // Reap the process started by fire_glxtest_process(). reap_glxtest_process(); diff --git a/include/unotools/VersionConfig.hxx b/include/unotools/VersionConfig.hxx new file mode 100644 index 000000000000..60b3a36c51e0 --- /dev/null +++ b/include/unotools/VersionConfig.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +#pragma once + +#include <officecfg/Office/Common.hxx> +#include <officecfg/Setup.hxx> +#include <unotools/configmgr.hxx> + +namespace utl +{ +/** This method is called when there's a need to determine if the + * current version of LibreOffice has been upgraded to a newer one. + + @param aUpdateVersion This variable is used to determine if + LibreOffice's previous version should be updated. + */ +static bool isProductVersionUpgraded(bool aUpdateVersion) +{ + OUString sSetupVersion = utl::ConfigManager::getProductVersion(); + sal_Int32 iCurrent + = sSetupVersion.getToken(0, '.').toInt32() * 10 + sSetupVersion.getToken(1, '.').toInt32(); + OUString sLastVersion = officecfg::Setup::Product::ooSetupLastVersion::get().value_or("0.0"); + sal_Int32 iLast + = sLastVersion.getToken(0, '.').toInt32() * 10 + sLastVersion.getToken(1, '.').toInt32(); + if (iCurrent > iLast) + { + if (aUpdateVersion) + { //update lastversion + std::shared_ptr<comphelper::ConfigurationChanges> batch( + comphelper::ConfigurationChanges::create()); + officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch); + batch->commit(); + } + return true; + } + return false; +} +} diff --git a/include/vcl/test/GraphicsRenderTests.hxx b/include/vcl/test/GraphicsRenderTests.hxx new file mode 100644 index 000000000000..9ff5b7c33d90 --- /dev/null +++ b/include/vcl/test/GraphicsRenderTests.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +#pragma once + +#include <vcl/bitmap.hxx> +#include <vcl/dllapi.h> +#include <vcl/graphicfilter.hxx> +#include <vcl/test/TestResult.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + +#include <vector> + +class VCL_PLUGIN_PUBLIC GraphicsRenderTests +{ + //For storing the results correspondingly to the tests. + std::vector<OString> m_aPassed; + std::vector<OString> m_aQuirky; + std::vector<OString> m_aFailed; + //For storing Skipped tests. + std::vector<OString> m_aSkipped; + //For storing the current graphics Backend in use. + OUString m_aCurGraphicsBackend; + + void testDrawRectWithRectangle(); + void testDrawRectWithPixel(); + void testDrawRectWithLine(); + void testDrawRectWithPolygon(); + void testDrawRectWithPolyLine(); + void testDrawRectWithPolyLineB2D(); + void testDrawRectWithPolyPolygon(); + void testDrawRectWithPolyPolygonB2D(); + void testDrawRectAAWithRectangle(); + void testDrawRectAAWithPixel(); + void testDrawRectAAWithLine(); + void testDrawRectAAWithPolygon(); + void testDrawRectAAWithPolyLine(); + void testDrawRectAAWithPolyLineB2D(); + void testDrawRectAAWithPolyPolygon(); + void testDrawRectAAWithPolyPolygonB2D(); + void testDrawFilledRectWithRectangle(); + void testDrawFilledRectWithPolygon(); + void testDrawFilledRectWithPolyPolygon(); + void testDrawFilledRectWithPolyPolygon2D(); + void testDrawDiamondWithPolygon(); + void testDrawDiamondWithLine(); + void testDrawDiamondWithPolyline(); + void testDrawDiamondWithPolylineB2D(); + void testDrawInvertWithRectangle(); + void testDrawInvertN50WithRectangle(); + void testDrawInvertTrackFrameWithRectangle(); + void testDrawBezierWithPolylineB2D(); + void testDrawBezierAAWithPolylineB2D(); + void testDrawBitmap(); + void testDrawTransformedBitmap(); + void testDrawBitmapExWithAlpha(); + void testDrawMask(); + void testDrawBlend(); + void testDrawXor(); + void testClipRectangle(); + void testClipPolygon(); + void testClipPolyPolygon(); + void testClipB2DPolyPolygon(); + void testDrawOutDev(); + void testDashedLine(); + void testLinearGradient(); + void testLinearGradientAngled(); + void testLinearGradientBorder(); + void testLinearGradientIntensity(); + void testLinearGradientSteps(); + void testAxialGradient(); + void testRadialGradient(); + void testRadialGradientOfs(); + void testLineJoinBevel(); + void testLineJoinRound(); + void testLineJoinMiter(); + void testLineJoinNone(); + void testLineCapRound(); + void testLineCapSquare(); + void testLineCapButt(); + void updateResult(vcl::test::TestResult const result, OString atestname); + void runALLTests(); + +public: + void run(); +}; diff --git a/include/vcl/test/TestResult.hxx b/include/vcl/test/TestResult.hxx new file mode 100644 index 000000000000..c64d4e88b871 --- /dev/null +++ b/include/vcl/test/TestResult.hxx @@ -0,0 +1,26 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +/** Rendering test result. + * + * Test either "Passed", "Failed" or "PassedWithQuirks" which means + * the test passed but at least one rendering quirk was detected. + */ +namespace vcl::test +{ +enum class TestResult +{ + Failed, + PassedWithQuirks, + Passed +}; +} diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f15e0aa5bfc4..e6bb74f628be 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -47,6 +47,7 @@ #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> +#include <unotools/VersionConfig.hxx> #include <svtools/miscopt.hxx> #include <tools/diagnose_ex.h> #include <com/sun/star/container/XIndexAccess.hpp> @@ -1407,12 +1408,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } //what's new infobar - OUString sSetupVersion = utl::ConfigManager::getProductVersion(); - sal_Int32 iCurrent = sSetupVersion.getToken(0,'.').toInt32() * 10 + sSetupVersion.getToken(1,'.').toInt32(); - OUString sLastVersion - = officecfg::Setup::Product::ooSetupLastVersion::get().value_or("0.0"); - sal_Int32 iLast = sLastVersion.getToken(0,'.').toInt32() * 10 + sLastVersion.getToken(1,'.').toInt32(); - if ((iCurrent > iLast) && !Application::IsHeadlessModeEnabled() && !bIsUITest) + if ((utl::isProductVersionUpgraded(true)) && !Application::IsHeadlessModeEnabled() && !bIsUITest) { VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO); if (pInfoBar) @@ -1421,10 +1417,6 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON)); rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler)); } - //update lastversion - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch); - batch->commit(); } // show tip-of-the-day dialog diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index b7d92bd35836..65b6cd8cc96e 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -500,6 +500,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/backendtest/outputdevice/polyline \ vcl/backendtest/outputdevice/polyline_b2d \ vcl/backendtest/outputdevice/rectangle \ + vcl/backendtest/GraphicsRenderTests \ vcl/jsdialog/jsdialogbuilder \ vcl/jsdialog/executor \ )) diff --git a/vcl/backendtest/GraphicsRenderTests.cxx b/vcl/backendtest/GraphicsRenderTests.cxx new file mode 100644 index 000000000000..7002c974fbea --- /dev/null +++ b/vcl/backendtest/GraphicsRenderTests.cxx @@ -0,0 +1,914 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#include <test/outputdevice.hxx> +#include <unotools/bootstrap.hxx> +#include <vcl/test/GraphicsRenderTests.hxx> +#include <tools/stream.hxx> + +#define SHOULD_ASSERT \ + (aOutDevTest.getRenderBackendName() != "qt5" && aOutDevTest.getRenderBackendName() != "qt5svp" \ + && aOutDevTest.getRenderBackendName() != "gtk3svp" \ + && aOutDevTest.getRenderBackendName() != "aqua" \ + && aOutDevTest.getRenderBackendName() != "gen" \ + && aOutDevTest.getRenderBackendName() != "genpsp" \ + && aOutDevTest.getRenderBackendName() != "win") + +void GraphicsRenderTests::updateResult(vcl::test::TestResult const result, OString atestname) +{ + switch (result) + { + case vcl::test::TestResult::Passed: + m_aPassed.push_back(atestname); + return; + case vcl::test::TestResult::PassedWithQuirks: + m_aQuirky.push_back(atestname); + return; + case vcl::test::TestResult::Failed: + m_aFailed.push_back(atestname); + return; + } +} + +void GraphicsRenderTests::testDrawRectWithRectangle() +{ + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + m_aCurGraphicsBackend = aOutDevTest.getRenderBackendName(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithRectangle"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithRectangle"); +} + +void GraphicsRenderTests::testDrawRectWithPixel() +{ + vcl::test::OutputDeviceTestPixel aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithPixel"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithPixel"); +} + +void GraphicsRenderTests::testDrawRectWithLine() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithLine"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithLine"); +} + +void GraphicsRenderTests::testDrawRectWithPolygon() +{ + vcl::test::OutputDeviceTestPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithPolygon"); +} + +void GraphicsRenderTests::testDrawRectWithPolyLine() +{ + vcl::test::OutputDeviceTestPolyLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithPolyLine"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithPolyLine"); +} + +void GraphicsRenderTests::testDrawRectWithPolyLineB2D() +{ + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithPolyLineB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithPolyLineB2D"); +} + +void GraphicsRenderTests::testDrawRectWithPolyPolygon() +{ + vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithPolyPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithPolyPolygon"); +} + +void GraphicsRenderTests::testDrawRectWithPolyPolygonB2D() +{ + vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectWithPolyPolygonB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); + updateResult(eResult, "testDrawRectWithPolyPolygonB2D"); +} + +void GraphicsRenderTests::testDrawRectAAWithRectangle() +{ + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithRectangle"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithRectangle"); +} + +void GraphicsRenderTests::testDrawRectAAWithPixel() +{ + vcl::test::OutputDeviceTestPixel aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithPixel"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithPixel"); +} + +void GraphicsRenderTests::testDrawRectAAWithLine() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithLine"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithLine"); +} + +void GraphicsRenderTests::testDrawRectAAWithPolygon() +{ + vcl::test::OutputDeviceTestPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithPolygon"); +} + +void GraphicsRenderTests::testDrawRectAAWithPolyLine() +{ + vcl::test::OutputDeviceTestPolyLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithPolyLine"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithPolyLine"); +} + +void GraphicsRenderTests::testDrawRectAAWithPolyLineB2D() +{ + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithPolyLineB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithPolyLineB2D"); +} + +void GraphicsRenderTests::testDrawRectAAWithPolyPolygon() +{ + vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithPolyPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithPolyPolygon"); +} + +void GraphicsRenderTests::testDrawRectAAWithPolyPolygonB2D() +{ + vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRectangle(true); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawRectAAWithPolyPolygonB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); + updateResult(eResult, "testDrawRectAAWithPolyPolygonB2D"); +} + +void GraphicsRenderTests::testDrawFilledRectWithRectangle() +{ + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawFilledRectWithRectangle"); + m_aSkipped.push_back("testDrawFilledRectWithRectangleWithAA"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); + updateResult(eResult, "testDrawFilledRectWithRectangle"); + aBitmap = aOutDevTest.setupFilledRectangle(true); + eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); + updateResult(eResult, "testDrawFilledRectWithRectangleWithAA"); +} + +void GraphicsRenderTests::testDrawFilledRectWithPolygon() +{ + vcl::test::OutputDeviceTestPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawFilledRectWithPolygon"); + m_aSkipped.push_back("testDrawFilledRectWithPolygonWithAA"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); + updateResult(eResult, "testDrawFilledRectWithPolygon"); + aBitmap = aOutDevTest.setupFilledRectangle(true); + eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); + updateResult(eResult, "testDrawFilledRectWithPolygonWithAA"); +} + +void GraphicsRenderTests::testDrawFilledRectWithPolyPolygon() +{ + vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawFilledRectWithPolyPolygon"); + m_aSkipped.push_back("testDrawFilledRectWithPolyPolygonWithAA"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); + updateResult(eResult, "testDrawFilledRectWithPolyPolygon"); + aBitmap = aOutDevTest.setupFilledRectangle(true); + eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); + updateResult(eResult, "testDrawFilledRectWithPolyPolygonWithAA"); +} + +void GraphicsRenderTests::testDrawFilledRectWithPolyPolygon2D() +{ + vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawFilledRectWithPolyPolygon2D"); + m_aSkipped.push_back("testDrawFilledRectWithPolyPolygon2DWithAA"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); + updateResult(eResult, "testDrawFilledRectWithPolyPolygon2D"); + aBitmap = aOutDevTest.setupFilledRectangle(true); + eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); + updateResult(eResult, "testDrawFilledRectWithPolyPolygon2DWithAA"); +} + +void GraphicsRenderTests::testDrawDiamondWithPolygon() +{ + vcl::test::OutputDeviceTestPolygon aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDiamond(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawDiamondWithPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); + updateResult(eResult, "testDrawDiamondWithPolygon"); +} + +void GraphicsRenderTests::testDrawDiamondWithLine() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDiamond(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawDiamondWithLine"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); + updateResult(eResult, "testDrawDiamondWithLine"); +} + +void GraphicsRenderTests::testDrawDiamondWithPolyline() +{ + vcl::test::OutputDeviceTestPolyLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDiamond(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawDiamondWithPolyline"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); + updateResult(eResult, "testDrawDiamondWithPolyline"); +} + +void GraphicsRenderTests::testDrawDiamondWithPolylineB2D() +{ + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDiamond(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawDiamondWithPolylineB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); + updateResult(eResult, "testDrawDiamondWithPolylineB2D"); +} + +void GraphicsRenderTests::testDrawInvertWithRectangle() +{ + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupInvert_NONE(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawInvertWithRectangle"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkInvertRectangle(aBitmap); + updateResult(eResult, "testDrawInvertWithRectangle"); +} + +void GraphicsRenderTests::testDrawInvertN50WithRectangle() +{ + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupInvert_N50(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawInvertN50WithRectangle"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkInvertN50Rectangle(aBitmap); + updateResult(eResult, "testDrawInvertN50WithRectangle"); +} + +void GraphicsRenderTests::testDrawInvertTrackFrameWithRectangle() +{ + vcl::test::OutputDeviceTestRect aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupInvert_TrackFrame(); + if (!(SHOULD_ASSERT && aOutDevTest.getRenderBackendName() != "svp")) + { + m_aSkipped.push_back("testDrawInvertTrackFrameWithRectangle"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestCommon::checkInvertTrackFrameRectangle(aBitmap); + updateResult(eResult, "testDrawInvertTrackFrameWithRectangle"); +} + +void GraphicsRenderTests::testDrawBezierWithPolylineB2D() +{ + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupBezier(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawBezierWithPolylineB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap); + updateResult(eResult, "testDrawBezierWithPolylineB2D"); +} + +void GraphicsRenderTests::testDrawBezierAAWithPolylineB2D() +{ + vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupAABezier(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawBezierAAWithPolylineB2D"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap); + updateResult(eResult, "testDrawBezierAAWithPolylineB2D"); +} + +void GraphicsRenderTests::testDrawBitmap() +{ + vcl::test::OutputDeviceTestBitmap aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDrawBitmap(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawBitmap"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap); + updateResult(eResult, "testDrawBitmap"); +} + +void GraphicsRenderTests::testDrawTransformedBitmap() +{ + vcl::test::OutputDeviceTestBitmap aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDrawTransformedBitmap(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawTransformedBitmap"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap); + updateResult(eResult, "testDrawTransformedBitmap"); +} + +void GraphicsRenderTests::testDrawBitmapExWithAlpha() +{ + vcl::test::OutputDeviceTestBitmap aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawBitmapExWithAlpha"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap); + updateResult(eResult, "testDrawBitmapExWithAlpha"); +} + +void GraphicsRenderTests::testDrawMask() +{ + vcl::test::OutputDeviceTestBitmap aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDrawMask(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawMask"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap); + updateResult(eResult, "testDrawMask"); +} + +void GraphicsRenderTests::testDrawBlend() +{ + vcl::test::OutputDeviceTestBitmap aOutDevTest; + BitmapEx aBitmapEx = aOutDevTest.setupDrawBlend(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawBlend"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkBlend(aBitmapEx); + updateResult(eResult, "testDrawBlend"); +} + +void GraphicsRenderTests::testDrawXor() +{ + vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupXOR(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawXor"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap); + updateResult(eResult, "testDrawXor"); +} + +void GraphicsRenderTests::testClipRectangle() +{ + vcl::test::OutputDeviceTestClip aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupClipRectangle(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testClipRectangle"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); + updateResult(eResult, "testClipRectangle"); +} + +void GraphicsRenderTests::testClipPolygon() +{ + vcl::test::OutputDeviceTestClip aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupClipPolygon(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testClipPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); + updateResult(eResult, "testClipPolygon"); +} + +void GraphicsRenderTests::testClipPolyPolygon() +{ + vcl::test::OutputDeviceTestClip aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupClipPolyPolygon(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testClipPolyPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); + updateResult(eResult, "testClipPolyPolygon"); +} + +void GraphicsRenderTests::testClipB2DPolyPolygon() +{ + vcl::test::OutputDeviceTestClip aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupClipB2DPolyPolygon(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testClipB2DPolyPolygon"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); + updateResult(eResult, "testClipB2DPolyPolygon"); +} + +void GraphicsRenderTests::testDrawOutDev() +{ + vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDrawOutDev(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDrawOutDev"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDev(aBitmap); + updateResult(eResult, "testDrawOutDev"); +} + +void GraphicsRenderTests::testDashedLine() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDashedLine(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testDashedLine"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkDashedLine(aBitmap); + updateResult(eResult, "testDashedLine"); +} + +void GraphicsRenderTests::testLinearGradient() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLinearGradient(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLinearGradient"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkLinearGradient(aBitmap); + updateResult(eResult, "testLinearGradient"); +} + +void GraphicsRenderTests::testLinearGradientAngled() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLinearGradientAngled(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLinearGradientAngled"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkLinearGradientAngled(aBitmap); + updateResult(eResult, "testLinearGradientAngled"); +} + +void GraphicsRenderTests::testLinearGradientBorder() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLinearGradientBorder(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLinearGradientBorder"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkLinearGradientBorder(aBitmap); + updateResult(eResult, "testLinearGradientBorder"); +} + +void GraphicsRenderTests::testLinearGradientIntensity() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLinearGradientIntensity(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLinearGradientIntensity"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkLinearGradientIntensity(aBitmap); + updateResult(eResult, "testLinearGradientIntensity"); +} + +void GraphicsRenderTests::testLinearGradientSteps() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLinearGradientSteps(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLinearGradientSteps"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkLinearGradientSteps(aBitmap); + updateResult(eResult, "testLinearGradientSteps"); +} + +void GraphicsRenderTests::testAxialGradient() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupAxialGradient(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testAxialGradient"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkAxialGradient(aBitmap); + updateResult(eResult, "testAxialGradient"); +} + +void GraphicsRenderTests::testRadialGradient() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRadialGradient(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testRadialGradient"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkRadialGradient(aBitmap); + updateResult(eResult, "testRadialGradient"); +} + +void GraphicsRenderTests::testRadialGradientOfs() +{ + vcl::test::OutputDeviceTestGradient aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupRadialGradientOfs(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testRadialGradientOfs"); + return; + } + vcl::test::TestResult eResult + = vcl::test::OutputDeviceTestGradient::checkRadialGradientOfs(aBitmap); + updateResult(eResult, "testRadialGradientOfs"); +} + +void GraphicsRenderTests::testLineJoinBevel() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineJoinBevel(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineJoinBevel"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinBevel(aBitmap); + updateResult(eResult, "testLineJoinBevel"); +} + +void GraphicsRenderTests::testLineJoinRound() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineJoinRound(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineJoinRound"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinRound(aBitmap); + updateResult(eResult, "testLineJoinRound"); +} + +void GraphicsRenderTests::testLineJoinMiter() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineJoinMiter(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineJoinMiter"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinMiter(aBitmap); + updateResult(eResult, "testLineJoinMiter"); +} + +void GraphicsRenderTests::testLineJoinNone() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineJoinNone(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineJoinNone"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinNone(aBitmap); + updateResult(eResult, "testLineJoinNone"); +} + +void GraphicsRenderTests::testLineCapRound() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineCapRound(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineCapRound"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineCapRound(aBitmap); + updateResult(eResult, "testLineCapRound"); +} + +void GraphicsRenderTests::testLineCapSquare() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineCapSquare(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineCapSquare"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineCapSquare(aBitmap); + updateResult(eResult, "testLineCapSquare"); +} + +void GraphicsRenderTests::testLineCapButt() +{ + vcl::test::OutputDeviceTestLine aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupLineCapButt(); + if (!SHOULD_ASSERT) + { + m_aSkipped.push_back("testLineCapButt"); + return; + } + vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineCapButt(aBitmap); + updateResult(eResult, "testLineCapButt"); +} + +void GraphicsRenderTests::runALLTests() +{ + testDrawRectWithRectangle(); + testDrawRectWithPixel(); + testDrawRectWithLine(); + testDrawRectWithPolygon(); + testDrawRectWithPolyLine(); + testDrawRectWithPolyLineB2D(); + testDrawRectWithPolyPolygon(); + testDrawRectWithPolyPolygonB2D(); + testDrawRectAAWithRectangle(); + testDrawRectAAWithPixel(); + testDrawRectAAWithLine(); + testDrawRectAAWithPolygon(); + testDrawRectAAWithPolyLine(); + testDrawRectAAWithPolyLineB2D(); + testDrawRectAAWithPolyPolygon(); + testDrawRectAAWithPolyPolygonB2D(); + testDrawFilledRectWithRectangle(); + testDrawFilledRectWithPolygon(); + testDrawFilledRectWithPolyPolygon(); + testDrawFilledRectWithPolyPolygon2D(); + testDrawDiamondWithPolygon(); + testDrawDiamondWithLine(); + testDrawDiamondWithPolyline(); + testDrawDiamondWithPolylineB2D(); + testDrawInvertWithRectangle(); + testDrawInvertN50WithRectangle(); + testDrawInvertTrackFrameWithRectangle(); + testDrawBezierWithPolylineB2D(); + testDrawBezierAAWithPolylineB2D(); + testDrawBitmap(); + testDrawTransformedBitmap(); + testDrawBitmapExWithAlpha(); + testDrawMask(); + testDrawBlend(); + testDrawXor(); + testClipRectangle(); + testClipPolygon(); + testClipPolyPolygon(); + testClipB2DPolyPolygon(); + testDrawOutDev(); + testDashedLine(); + testLinearGradient(); + testLinearGradientAngled(); + testLinearGradientBorder(); + testLinearGradientIntensity(); + testLinearGradientSteps(); + testAxialGradient(); + testRadialGradient(); + testRadialGradientOfs(); + testLineJoinBevel(); + testLineJoinRound(); + testLineJoinMiter(); + testLineJoinNone(); + testLineCapRound(); + testLineCapSquare(); + testLineCapButt(); +} + +void GraphicsRenderTests::run() +{ + runALLTests(); + //Storing the test's results in the main user installation directory. + OUString aUserInstallPath; + ::utl::Bootstrap::locateUserInstallation(aUserInstallPath); + SvFileStream logFile(aUserInstallPath + "/user/GraphicsRenderTests.log", + StreamMode::WRITE | StreamMode::TRUNC); + OUString atemp = "Graphic Backend used: " + m_aCurGraphicsBackend; + logFile.WriteLine(OUStringToOString(atemp, RTL_TEXTENCODING_UTF8)); + logFile.WriteLine("Passed tests : " + std::to_string(m_aPassed.size())); + logFile.WriteLine("Quirky tests : " + std::to_string(m_aQuirky.size())); + logFile.WriteLine("Failed tests : " + std::to_string(m_aFailed.size())); + logFile.WriteLine("Skipped tests : " + std::to_string(m_aSkipped.size())); + logFile.WriteLine("\n---Name of the tests that failed---"); + if (m_aFailed.size() > 0) + { + for (const class OString& tests : m_aFailed) + { + logFile.WriteLine(tests); + } + } + else + { + logFile.WriteLine("No test has been failed."); + } + logFile.WriteLine("\n---Name of the tests that were Quirky---"); + if (m_aQuirky.size() > 0) + { + for (const class OString& tests : m_aQuirky) + { + logFile.WriteLine(tests); + } + } + else + { + logFile.WriteLine("No test was Quirky."); + } + logFile.WriteLine("\n---Name of the tests that were Skipped---"); + if (m_aSkipped.size() > 0) + { + for (const class OString& tests : m_aSkipped) + { + logFile.WriteLine(tests); + } + } + else + { + logFile.WriteLine("No test was Skipped."); + } +} diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx index 706cbce67ec9..a13183d8112e 100644 --- a/vcl/inc/test/outputdevice.hxx +++ b/vcl/inc/test/outputdevice.hxx @@ -12,21 +12,10 @@ #define INCLUDED_VCL_OUTDEVTESTS_HXX #include <vcl/virdev.hxx> +#include <vcl/test/TestResult.hxx> namespace vcl::test { -/** Rendering test result. - * - * Test either "Passed", "Failed" or "PassedWithQuirks" which means - * the test passed but at least one rendering quirk was detected. - */ -enum class TestResult -{ - Failed, - PassedWithQuirks, - Passed -}; - /** Common subclass for output device rendering tests. */ class VCL_DLLPUBLIC OutputDeviceTestCommon _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits