cui/Library_cui.mk | 1 cui/UIConfig_cui.mk | 2 cui/source/dialogs/GraphicTestsDialog.cxx | 78 +++-- cui/source/dialogs/ImageViewerDialog.cxx | 24 + cui/source/inc/GraphicsTestsDialog.hxx | 34 ++ cui/source/inc/ImageViewerDialog.hxx | 20 + cui/uiconfig/ui/graphictestdlg.ui | 101 +++++- cui/uiconfig/ui/graphictestentry.ui | 43 ++ cui/uiconfig/ui/imageviewer.ui | 44 ++ include/vcl/test/GraphicsRenderTests.hxx | 39 +- vcl/backendtest/GraphicsRenderTests.cxx | 455 ++++++++++++++++++++---------- 11 files changed, 625 insertions(+), 216 deletions(-)
New commits: commit 3057ee8ba01535324f57978569526988664eb53a Author: homeboy445 <akshitsa...@gmail.com> AuthorDate: Tue Jun 22 16:54:34 2021 +0530 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Jul 10 00:34:38 2021 +0200 Added support for viewing results in the VCL tests UI box The user can now easily view the result of any VCL test by just clicking on it - which would show them the resultant bitmap of that corresponding test. Change-Id: I57c0c2ab3662a9abec45ba7fc230c9299dcd9279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117657 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 345f84b7f008..bc4f1e50c139 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -139,6 +139,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/dialogs/postdlg \ cui/source/dialogs/QrCodeGenDialog \ cui/source/dialogs/GraphicTestsDialog \ + cui/source/dialogs/ImageViewerDialog \ cui/source/dialogs/scriptdlg \ cui/source/dialogs/SignatureLineDialogBase \ cui/source/dialogs/SignatureLineDialog \ diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index 73da8e159f09..3af5d8e698e7 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -83,6 +83,8 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/gallerytitledialog \ cui/uiconfig/ui/galleryupdateprogress \ cui/uiconfig/ui/graphictestdlg \ + cui/uiconfig/ui/graphictestentry \ + cui/uiconfig/ui/imageviewer \ cui/uiconfig/ui/hangulhanjaadddialog \ cui/uiconfig/ui/hangulhanjaeditdictdialog \ cui/uiconfig/ui/hangulhanjaconversiondialog \ diff --git a/cui/source/dialogs/GraphicTestsDialog.cxx b/cui/source/dialogs/GraphicTestsDialog.cxx index 275d33d75886..000129444cd5 100644 --- a/cui/source/dialogs/GraphicTestsDialog.cxx +++ b/cui/source/dialogs/GraphicTestsDialog.cxx @@ -8,48 +8,70 @@ */ #include <GraphicsTestsDialog.hxx> +#include <vcl/test/GraphicsRenderTests.hxx> + +GraphicTestEntry::GraphicTestEntry(weld::Container* pParent, weld::Dialog* pDialog, + OUString aTestName, OUString aTestStatus, Bitmap aTestBitmap) + : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/graphictestentry.ui")) + , m_xContainer(m_xBuilder->weld_container("gptestbox")) + , m_xTestLabel(m_xBuilder->weld_label("gptestlabel")) + , m_xTestButton(m_xBuilder->weld_button("gptestbutton")) + , m_xResultBitmap(aTestBitmap) +{ + m_xParentDialog = pDialog; + m_xTestLabel->set_label(aTestName); + m_xTestButton->set_label(aTestStatus); + m_xTestButton->set_tooltip_text(aTestName); + m_xTestButton->set_background( + aTestStatus == "PASSED" + ? COL_LIGHTGREEN + : aTestStatus == "QUIRKY" ? COL_YELLOW + : aTestStatus == "FAILED" ? COL_LIGHTRED : COL_LIGHTGRAY); + m_xTestButton->connect_clicked(LINK(this, GraphicTestEntry, HandleResultViewRequest)); + m_xContainer->show(); +} + +IMPL_LINK(GraphicTestEntry, HandleResultViewRequest, weld::Button&, rButton, void) +{ + if (rButton.get_label() == "SKIPPED") + { + return; + } + ImageViewerDialog m_ImgVwDialog(m_xParentDialog, BitmapEx(m_xResultBitmap), + rButton.get_tooltip_text()); + m_ImgVwDialog.run(); +} GraphicsTestsDialog::GraphicsTestsDialog(weld::Window* pParent) : GenericDialogController(pParent, "cui/ui/graphictestdlg.ui", "GraphicTestsDialog") - , m_xResultLog(m_xBuilder->weld_text_view("gptestresults")) + , m_xResultLog(m_xBuilder->weld_text_view("gptest_txtVW")) , m_xDownloadResults(m_xBuilder->weld_button("gptest_downld")) + , m_xContainerBox(m_xBuilder->weld_box("gptest_box")) { - m_xResultLog->set_text("Running tests..."); m_xDownloadResults->connect_clicked(LINK(this, GraphicsTestsDialog, HandleDownloadRequest)); - runGraphicsTestandUpdateLog(); } -void GraphicsTestsDialog::runGraphicsTestandUpdateLog() +short GraphicsTestsDialog::run() { - GraphicsRenderTests TestObject; - TestObject.run(); - OUString atemp = "--General Info--\nGraphics Backend used : " + TestObject.m_aCurGraphicsBackend - + "\nPassed Tests : " + OUString::number(TestObject.m_aPassed.size()) - + "\nQuirky Tests : " + OUString::number(TestObject.m_aQuirky.size()) - + "\nFailed Tests : " + OUString::number(TestObject.m_aFailed.size()) - + "\nSkipped Tests : " + OUString::number(TestObject.m_aSkipped.size()) - + "\n\n--Test Details--\n"; - OString writeResults; - for (const class OString& tests : TestObject.m_aPassed) - { - writeResults += tests + " [PASSED]\n"; - } - for (const class OString& tests : TestObject.m_aQuirky) - { - writeResults += tests + " [QUIRKY]\n"; - } - for (const class OString& tests : TestObject.m_aFailed) - { - writeResults += tests + " [FAILED]\n"; - } - for (const class OString& tests : TestObject.m_aSkipped) + GraphicsRenderTests aTestObject; + aTestObject.run(true); + OUString aResultLog = aTestObject.getResultString() + + "\n(Click on any test to view its resultant bitmap image)"; + m_xResultLog->set_text(aResultLog); + sal_Int32 nTestNumber = 0; + for (VclTestResult& tests : aTestObject.getTestResults()) { - writeResults += tests + " [SKIPPED]\n"; + auto xGpTest = std::make_unique<GraphicTestEntry>(m_xContainerBox.get(), m_xDialog.get(), + tests.getTestName(), tests.getStatus(), + tests.getBitmap()); + m_xContainerBox->reorder_child(xGpTest->get_widget(), nTestNumber++); + m_xGraphicTestEntries.push_back(std::move(xGpTest)); } - m_xResultLog->set_text(atemp + OStringToOUString(writeResults, RTL_TEXTENCODING_UTF8)); + return GenericDialogController::run(); } IMPL_STATIC_LINK_NOARG(GraphicsTestsDialog, HandleDownloadRequest, weld::Button&, void) { //TODO: Enter code for downloading the results to user's system. + return; } diff --git a/cui/source/dialogs/ImageViewerDialog.cxx b/cui/source/dialogs/ImageViewerDialog.cxx new file mode 100644 index 000000000000..b245c8c08b60 --- /dev/null +++ b/cui/source/dialogs/ImageViewerDialog.cxx @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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 <vcl/virdev.hxx> +#include <ImageViewerDialog.hxx> + +ImageViewerDialog::ImageViewerDialog(weld::Dialog* pParent, BitmapEx aBitmap, OUString atitle) + : GenericDialogController(pParent, "cui/ui/imageviewer.ui", "ImageViewerDialog") + , m_xDisplayImage(m_xBuilder->weld_image("ImgVW_mainImage")) +{ + m_xDialog->set_title(atitle); + aBitmap.Scale(Size(300, 300), BmpScaleFlag::Fast); + ScopedVclPtr<VirtualDevice> m_pVirDev = m_xDisplayImage->create_virtual_device(); + m_pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel()); + m_pVirDev->DrawBitmapEx(Point(0, 0), aBitmap); + m_xDisplayImage->set_image(m_pVirDev.get()); + m_pVirDev.disposeAndClear(); +} diff --git a/cui/source/inc/GraphicsTestsDialog.hxx b/cui/source/inc/GraphicsTestsDialog.hxx index d851fbf0b528..2912d898efb7 100644 --- a/cui/source/inc/GraphicsTestsDialog.hxx +++ b/cui/source/inc/GraphicsTestsDialog.hxx @@ -8,17 +8,45 @@ */ #pragma once +#include <vcl/bitmapex.hxx> +#include <vcl/svapp.hxx> #include <vcl/weld.hxx> -#include <vcl/test/GraphicsRenderTests.hxx> +#include <tools/link.hxx> + +#include "ImageViewerDialog.hxx" + +#include <vector> + +class GraphicTestEntry final +{ +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xContainer; + std::unique_ptr<weld::Label> m_xTestLabel; + std::unique_ptr<weld::Button> m_xTestButton; + + weld::Dialog* m_xParentDialog; + + Bitmap m_xResultBitmap; + +public: + DECL_LINK(HandleResultViewRequest, weld::Button&, void); + GraphicTestEntry(weld::Container* pParent, weld::Dialog* pDialog, OUString aTestName, + OUString aTestStatus, Bitmap aTestBitmap); + weld::Widget* get_widget() const { return m_xContainer.get(); } +}; class GraphicsTestsDialog : public weld::GenericDialogController { std::unique_ptr<weld::TextView> m_xResultLog; std::unique_ptr<weld::Button> m_xDownloadResults; + std::unique_ptr<weld::Box> m_xContainerBox; + + std::vector<std::unique_ptr<GraphicTestEntry>> m_xGraphicTestEntries; DECL_STATIC_LINK(GraphicsTestsDialog, HandleDownloadRequest, weld::Button&, void); public: GraphicsTestsDialog(weld::Window* pParent); - void runGraphicsTestandUpdateLog(); -}; \ No newline at end of file + virtual short run() override; +}; diff --git a/cui/source/inc/ImageViewerDialog.hxx b/cui/source/inc/ImageViewerDialog.hxx new file mode 100644 index 000000000000..884deb18d4a7 --- /dev/null +++ b/cui/source/inc/ImageViewerDialog.hxx @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/bitmapex.hxx> +#include <vcl/weld.hxx> + +class ImageViewerDialog : public weld::GenericDialogController +{ + std::unique_ptr<weld::Image> m_xDisplayImage; + +public: + ImageViewerDialog(weld::Dialog* pParent, BitmapEx aBitmap, OUString atitle); +}; diff --git a/cui/uiconfig/ui/graphictestdlg.ui b/cui/uiconfig/ui/graphictestdlg.ui index 339688d72d2f..2e1252a2bf94 100644 --- a/cui/uiconfig/ui/graphictestdlg.ui +++ b/cui/uiconfig/ui/graphictestdlg.ui @@ -8,11 +8,13 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="default-width">500</property> - <property name="default-height">450</property> + <property name="default-height">550</property> <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="gptest-main"> <property name="can-focus">False</property> + <property name="margin-top">4</property> + <property name="margin-bottom">4</property> <property name="orientation">vertical</property> <property name="spacing">2</property> <child internal-child="action_area"> @@ -41,7 +43,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> <child> @@ -60,51 +62,100 @@ </packing> </child> <child> - <object class="GtkLabel" id="gptest_label1"> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="shadow-type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <child> + <object class="GtkTextView" id="gptest_txtVW"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="vexpand">True</property> + <property name="pixels-above-lines">2</property> + <property name="pixels-below-lines">2</property> + <property name="editable">False</property> + <property name="left-margin">2</property> + <property name="right-margin">2</property> + <property name="top-margin">2</property> + <property name="bottom-margin">2</property> + <accessibility> + <relation type="labelled-by" target="gptest_log"/> + </accessibility> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="gptest_log"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="margin-end">400</property> - <property name="margin-top">10</property> - <property name="label" translatable="yes" context="graphictestdlg|gptest_label1">Results log:</property> - <property name="justify">center</property> + <property name="halign">start</property> + <property name="margin-start">5</property> + <property name="label" translatable="yes" context="graphictestdlg|gptest_log">Result Log:</property> <accessibility> - <relation type="label-for" target="gptestresults"/> + <relation type="label-for" target="gptest_txtVW"/> </accessibility> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkScrolledWindow" id="gpscrollerwindow1"> + <object class="GtkLabel" id="gptest_detail"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-top">20</property> + <property name="margin-bottom">10</property> + <property name="label" translatable="yes" context="graphictestdlg|gptest_detail">Test Details</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="gptest_scrollwindow1"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="shadow-type">in</property> <child> - <object class="GtkTextView" id="gptestresults"> + <object class="GtkViewport"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="pixels-above-lines">3</property> - <property name="pixels-below-lines">3</property> - <property name="editable">False</property> - <property name="wrap-mode">word-char</property> - <property name="left-margin">10</property> - <property name="right-margin">10</property> - <property name="top-margin">10</property> - <property name="bottom-margin">10</property> - <property name="indent">2</property> - <accessibility> - <relation type="labelled-by" target="gptest_label1"/> - </accessibility> + <property name="can-focus">False</property> + <child> + <object class="GtkBox" id="gptest_box"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="hexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">5</property> + <child> + <placeholder/> + </child> + </object> + </child> </object> </child> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">5</property> </packing> </child> </object> diff --git a/cui/uiconfig/ui/graphictestentry.ui b/cui/uiconfig/ui/graphictestentry.ui new file mode 100644 index 000000000000..2248b433fed7 --- /dev/null +++ b/cui/uiconfig/ui/graphictestentry.ui @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="cui"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkBox" id="gptestbox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="border-width">3</property> + <child> + <object class="GtkLabel" id="gptestlabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">4</property> + <property name="hexpand">True</property> + <property name="selectable">True</property> + <property name="xalign">0</property> + <child internal-child="accessible"> + <object class="AtkObject" id="gptestlabel-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="gptestbutton"> + <property name="label" translatable="yes" context="graphictestentry|gptestbutton">button</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> +</interface> diff --git a/cui/uiconfig/ui/imageviewer.ui b/cui/uiconfig/ui/imageviewer.ui new file mode 100644 index 000000000000..6008137aded2 --- /dev/null +++ b/cui/uiconfig/ui/imageviewer.ui @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="cui"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkDialog" id="ImageViewerDialog"> + <property name="can-focus">False</property> + <property name="resizable">False</property> + <property name="default-width">350</property> + <property name="default-height">350</property> + <property name="type-hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="imgVW_bx"> + <property name="can-focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="imgVW_btngrid"> + <property name="can-focus">False</property> + <property name="layout-style">end</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkImage" id="ImgVW_mainImage"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> +</interface> diff --git a/include/vcl/test/GraphicsRenderTests.hxx b/include/vcl/test/GraphicsRenderTests.hxx index bfe536b7aa53..7c0fca129669 100644 --- a/include/vcl/test/GraphicsRenderTests.hxx +++ b/include/vcl/test/GraphicsRenderTests.hxx @@ -17,19 +17,35 @@ #include <vector> -class VCL_PLUGIN_PUBLIC GraphicsRenderTests +class VCL_PLUGIN_PUBLIC VclTestResult { + OUString m_aTestName; + //For storing the result of the test. + OUString m_aTestStatus; + //For storing the resultant bitmap correspondingly to the test. + Bitmap m_aResultantBitmap; + public: - //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; + VclTestResult(OUString atestName, OUString atestStatus, Bitmap atestBitmap) + : m_aTestName(atestName) + , m_aTestStatus(atestStatus) + , m_aResultantBitmap(atestBitmap) + { + } + OUString getTestName() { return m_aTestName; } + OUString getStatus() { return m_aTestStatus; } + Bitmap getBitmap() { return m_aResultantBitmap; } +}; + +class VCL_PLUGIN_PUBLIC GraphicsRenderTests +{ + bool m_aStoreResultantBitmap; + + //For storing the test's info + std::vector<VclTestResult> m_aTestResult; //For storing the current graphics Backend in use. OUString m_aCurGraphicsBackend; -private: void testDrawRectWithRectangle(); void testDrawRectWithPixel(); void testDrawRectWithLine(); @@ -86,9 +102,12 @@ private: void testLineCapRound(); void testLineCapSquare(); void testLineCapButt(); - void updateResult(vcl::test::TestResult const result, OString atestname); + static OUString returnTestStatus(vcl::test::TestResult const result); void runALLTests(); + void appendTestResult(OUString aTestName, OUString aTestStatus, Bitmap aTestBitmap = Bitmap()); public: - void run(); + std::vector<VclTestResult>& getTestResults(); + OUString getResultString(); + void run(bool storeResultBitmap = false); }; diff --git a/vcl/backendtest/GraphicsRenderTests.cxx b/vcl/backendtest/GraphicsRenderTests.cxx index 7002c974fbea..82b55f7450af 100644 --- a/vcl/backendtest/GraphicsRenderTests.cxx +++ b/vcl/backendtest/GraphicsRenderTests.cxx @@ -13,6 +13,8 @@ #include <vcl/test/GraphicsRenderTests.hxx> #include <tools/stream.hxx> +#include <unordered_map> + #define SHOULD_ASSERT \ (aOutDevTest.getRenderBackendName() != "qt5" && aOutDevTest.getRenderBackendName() != "qt5svp" \ && aOutDevTest.getRenderBackendName() != "gtk3svp" \ @@ -21,20 +23,18 @@ && aOutDevTest.getRenderBackendName() != "genpsp" \ && aOutDevTest.getRenderBackendName() != "win") -void GraphicsRenderTests::updateResult(vcl::test::TestResult const result, OString atestname) +OUString GraphicsRenderTests::returnTestStatus(vcl::test::TestResult const result) { switch (result) { case vcl::test::TestResult::Passed: - m_aPassed.push_back(atestname); - return; + return "PASSED"; case vcl::test::TestResult::PassedWithQuirks: - m_aQuirky.push_back(atestname); - return; + return "QUIRKY"; case vcl::test::TestResult::Failed: - m_aFailed.push_back(atestname); - return; + return "FAILED"; } + return "SKIPPED"; } void GraphicsRenderTests::testDrawRectWithRectangle() @@ -42,763 +42,879 @@ void GraphicsRenderTests::testDrawRectWithRectangle() vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); m_aCurGraphicsBackend = aOutDevTest.getRenderBackendName(); + OUString atestName = "testDrawRectWithRectangle"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithRectangle"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithPixel() { vcl::test::OutputDeviceTestPixel aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithPixel"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithPixel"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithPixel"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithLine() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithLine"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithLine"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithLine"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithPolygon() { vcl::test::OutputDeviceTestPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithPolyLine() { vcl::test::OutputDeviceTestPolyLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithPolyLine"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithPolyLine"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithPolyLine"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithPolyLineB2D() { vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithPolyLineB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithPolyLineB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithPolyLineB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithPolyPolygon() { vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithPolyPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithPolyPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithPolyPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectWithPolyPolygonB2D() { vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(false); + OUString atestName = "testDrawRectWithPolyPolygonB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectWithPolyPolygonB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap); - updateResult(eResult, "testDrawRectWithPolyPolygonB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithRectangle() { vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithRectangle"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithRectangle"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithPixel() { vcl::test::OutputDeviceTestPixel aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithPixel"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithPixel"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithPixel"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithLine() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithLine"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithLine"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithLine"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithPolygon() { vcl::test::OutputDeviceTestPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithPolyLine() { vcl::test::OutputDeviceTestPolyLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithPolyLine"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithPolyLine"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithPolyLine"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithPolyLineB2D() { vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithPolyLineB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithPolyLineB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithPolyLineB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithPolyPolygon() { vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithPolyPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithPolyPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithPolyPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawRectAAWithPolyPolygonB2D() { vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRectangle(true); + OUString atestName = "testDrawRectAAWithPolyPolygonB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawRectAAWithPolyPolygonB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap); - updateResult(eResult, "testDrawRectAAWithPolyPolygonB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawFilledRectWithRectangle() { vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + OUString atestName = "testDrawFilledRectWithRectangle"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawFilledRectWithRectangle"); - m_aSkipped.push_back("testDrawFilledRectWithRectangleWithAA"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); - updateResult(eResult, "testDrawFilledRectWithRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); + atestName += "WithAA"; aBitmap = aOutDevTest.setupFilledRectangle(true); eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); - updateResult(eResult, "testDrawFilledRectWithRectangleWithAA"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawFilledRectWithPolygon() { vcl::test::OutputDeviceTestPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + OUString atestName = "testDrawFilledRectWithPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawFilledRectWithPolygon"); - m_aSkipped.push_back("testDrawFilledRectWithPolygonWithAA"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); - updateResult(eResult, "testDrawFilledRectWithPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); + atestName += "WithAA"; aBitmap = aOutDevTest.setupFilledRectangle(true); eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); - updateResult(eResult, "testDrawFilledRectWithPolygonWithAA"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawFilledRectWithPolyPolygon() { vcl::test::OutputDeviceTestPolyPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + OUString atestName = "testDrawFilledRectWithPolyPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawFilledRectWithPolyPolygon"); - m_aSkipped.push_back("testDrawFilledRectWithPolyPolygonWithAA"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); - updateResult(eResult, "testDrawFilledRectWithPolyPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); + atestName += "WithAA"; aBitmap = aOutDevTest.setupFilledRectangle(true); eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); - updateResult(eResult, "testDrawFilledRectWithPolyPolygonWithAA"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawFilledRectWithPolyPolygon2D() { vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false); + OUString atestName = "testDrawFilledRectWithPolyPolygon2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawFilledRectWithPolyPolygon2D"); - m_aSkipped.push_back("testDrawFilledRectWithPolyPolygon2DWithAA"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false); - updateResult(eResult, "testDrawFilledRectWithPolyPolygon2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); + atestName += "WithAA"; aBitmap = aOutDevTest.setupFilledRectangle(true); eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true); - updateResult(eResult, "testDrawFilledRectWithPolyPolygon2DWithAA"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawDiamondWithPolygon() { vcl::test::OutputDeviceTestPolygon aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDiamond(); + OUString atestName = "testDrawDiamondWithPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawDiamondWithPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); - updateResult(eResult, "testDrawDiamondWithPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawDiamondWithLine() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDiamond(); + OUString atestName = "testDrawDiamondWithLine"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawDiamondWithLine"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); - updateResult(eResult, "testDrawDiamondWithLine"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawDiamondWithPolyline() { vcl::test::OutputDeviceTestPolyLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDiamond(); + OUString atestName = "testDrawDiamondWithPolyline"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawDiamondWithPolyline"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); - updateResult(eResult, "testDrawDiamondWithPolyline"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawDiamondWithPolylineB2D() { vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDiamond(); + OUString atestName = "testDrawDiamondWithPolylineB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawDiamondWithPolylineB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap); - updateResult(eResult, "testDrawDiamondWithPolylineB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawInvertWithRectangle() { vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupInvert_NONE(); + OUString atestName = "testDrawInvertWithRectangle"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawInvertWithRectangle"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkInvertRectangle(aBitmap); - updateResult(eResult, "testDrawInvertWithRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawInvertN50WithRectangle() { vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupInvert_N50(); + OUString atestName = "testDrawInvertN50WithRectangle"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawInvertN50WithRectangle"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkInvertN50Rectangle(aBitmap); - updateResult(eResult, "testDrawInvertN50WithRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawInvertTrackFrameWithRectangle() { vcl::test::OutputDeviceTestRect aOutDevTest; Bitmap aBitmap = aOutDevTest.setupInvert_TrackFrame(); + OUString atestName = "testDrawInvertTrackFrameWithRectangle"; if (!(SHOULD_ASSERT && aOutDevTest.getRenderBackendName() != "svp")) { - m_aSkipped.push_back("testDrawInvertTrackFrameWithRectangle"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkInvertTrackFrameRectangle(aBitmap); - updateResult(eResult, "testDrawInvertTrackFrameWithRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawBezierWithPolylineB2D() { vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupBezier(); + OUString atestName = "testDrawBezierWithPolylineB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawBezierWithPolylineB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap); - updateResult(eResult, "testDrawBezierWithPolylineB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawBezierAAWithPolylineB2D() { vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest; Bitmap aBitmap = aOutDevTest.setupAABezier(); + OUString atestName = "testDrawBezierAAWithPolylineB2D"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawBezierAAWithPolylineB2D"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap); - updateResult(eResult, "testDrawBezierAAWithPolylineB2D"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawBitmap() { vcl::test::OutputDeviceTestBitmap aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDrawBitmap(); + OUString atestName = "testDrawBitmap"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawBitmap"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap); - updateResult(eResult, "testDrawBitmap"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawTransformedBitmap() { vcl::test::OutputDeviceTestBitmap aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDrawTransformedBitmap(); + OUString atestName = "testDrawTransformedBitmap"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawTransformedBitmap"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap); - updateResult(eResult, "testDrawTransformedBitmap"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawBitmapExWithAlpha() { vcl::test::OutputDeviceTestBitmap aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha(); + OUString atestName = "testDrawBitmapExWithAlpha"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawBitmapExWithAlpha"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap); - updateResult(eResult, "testDrawBitmapExWithAlpha"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawMask() { vcl::test::OutputDeviceTestBitmap aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDrawMask(); + OUString atestName = "testDrawMask"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawMask"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap); - updateResult(eResult, "testDrawMask"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawBlend() { vcl::test::OutputDeviceTestBitmap aOutDevTest; BitmapEx aBitmapEx = aOutDevTest.setupDrawBlend(); + OUString atestName = "testDrawBlend"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawBlend"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestBitmap::checkBlend(aBitmapEx); - updateResult(eResult, "testDrawBlend"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmapEx.GetBitmap() : Bitmap())); } void GraphicsRenderTests::testDrawXor() { vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest; Bitmap aBitmap = aOutDevTest.setupXOR(); + OUString atestName = "testDrawXor"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawXor"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap); - updateResult(eResult, "testDrawXor"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testClipRectangle() { vcl::test::OutputDeviceTestClip aOutDevTest; Bitmap aBitmap = aOutDevTest.setupClipRectangle(); + OUString atestName = "testClipRectangle"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testClipRectangle"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); - updateResult(eResult, "testClipRectangle"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testClipPolygon() { vcl::test::OutputDeviceTestClip aOutDevTest; Bitmap aBitmap = aOutDevTest.setupClipPolygon(); + OUString atestName = "testClipPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testClipPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); - updateResult(eResult, "testClipPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testClipPolyPolygon() { vcl::test::OutputDeviceTestClip aOutDevTest; Bitmap aBitmap = aOutDevTest.setupClipPolyPolygon(); + OUString atestName = "testClipPolyPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testClipPolyPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); - updateResult(eResult, "testClipPolyPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testClipB2DPolyPolygon() { vcl::test::OutputDeviceTestClip aOutDevTest; Bitmap aBitmap = aOutDevTest.setupClipB2DPolyPolygon(); + OUString atestName = "testClipB2DPolyPolygon"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testClipB2DPolyPolygon"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap); - updateResult(eResult, "testClipB2DPolyPolygon"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDrawOutDev() { vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDrawOutDev(); + OUString atestName = "testDrawOutDev"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDrawOutDev"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDev(aBitmap); - updateResult(eResult, "testDrawOutDev"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testDashedLine() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDashedLine(); + OUString atestName = "testDashedLine"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testDashedLine"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkDashedLine(aBitmap); - updateResult(eResult, "testDashedLine"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLinearGradient() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLinearGradient(); + OUString atestName = "testLinearGradient"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLinearGradient"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradient(aBitmap); - updateResult(eResult, "testLinearGradient"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLinearGradientAngled() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLinearGradientAngled(); + OUString atestName = "testLinearGradientAngled"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLinearGradientAngled"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientAngled(aBitmap); - updateResult(eResult, "testLinearGradientAngled"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLinearGradientBorder() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLinearGradientBorder(); + OUString atestName = "testLinearGradientBorder"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLinearGradientBorder"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientBorder(aBitmap); - updateResult(eResult, "testLinearGradientBorder"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLinearGradientIntensity() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLinearGradientIntensity(); + OUString atestName = "testLinearGradientIntensity"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLinearGradientIntensity"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientIntensity(aBitmap); - updateResult(eResult, "testLinearGradientIntensity"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLinearGradientSteps() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLinearGradientSteps(); + OUString atestName = "testLinearGradientSteps"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLinearGradientSteps"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientSteps(aBitmap); - updateResult(eResult, "testLinearGradientSteps"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testAxialGradient() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupAxialGradient(); + OUString atestName = "testAxialGradient"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testAxialGradient"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkAxialGradient(aBitmap); - updateResult(eResult, "testAxialGradient"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testRadialGradient() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRadialGradient(); + OUString atestName = "testRadialGradient"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testRadialGradient"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkRadialGradient(aBitmap); - updateResult(eResult, "testRadialGradient"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testRadialGradientOfs() { vcl::test::OutputDeviceTestGradient aOutDevTest; Bitmap aBitmap = aOutDevTest.setupRadialGradientOfs(); + OUString atestName = "testRadialGradientOfs"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testRadialGradientOfs"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestGradient::checkRadialGradientOfs(aBitmap); - updateResult(eResult, "testRadialGradientOfs"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineJoinBevel() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineJoinBevel(); + OUString atestName = "testLineJoinBevel"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineJoinBevel"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinBevel(aBitmap); - updateResult(eResult, "testLineJoinBevel"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineJoinRound() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineJoinRound(); + OUString atestName = "testLineJoinRound"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineJoinRound"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinRound(aBitmap); - updateResult(eResult, "testLineJoinRound"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineJoinMiter() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineJoinMiter(); + OUString atestName = "testLineJoinMiter"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineJoinMiter"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinMiter(aBitmap); - updateResult(eResult, "testLineJoinMiter"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineJoinNone() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineJoinNone(); + OUString atestName = "testLineJoinNone"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineJoinNone"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineJoinNone(aBitmap); - updateResult(eResult, "testLineJoinNone"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineCapRound() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineCapRound(); + OUString atestName = "testLineCapRound"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineCapRound"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineCapRound(aBitmap); - updateResult(eResult, "testLineCapRound"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineCapSquare() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineCapSquare(); + OUString atestName = "testLineCapSquare"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineCapSquare"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineCapSquare(aBitmap); - updateResult(eResult, "testLineCapSquare"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::testLineCapButt() { vcl::test::OutputDeviceTestLine aOutDevTest; Bitmap aBitmap = aOutDevTest.setupLineCapButt(); + OUString atestName = "testLineCapButt"; if (!SHOULD_ASSERT) { - m_aSkipped.push_back("testLineCapButt"); + appendTestResult(atestName, "SKIPPED"); return; } vcl::test::TestResult eResult = vcl::test::OutputDeviceTestLine::checkLineCapButt(aBitmap); - updateResult(eResult, "testLineCapButt"); + appendTestResult(atestName, returnTestStatus(eResult), + (m_aStoreResultantBitmap ? aBitmap : Bitmap())); } void GraphicsRenderTests::runALLTests() @@ -861,54 +977,93 @@ void GraphicsRenderTests::runALLTests() testLineCapButt(); } -void GraphicsRenderTests::run() +void GraphicsRenderTests::appendTestResult(OUString aTestName, OUString aTestStatus, + Bitmap aTestBitmap) +{ + m_aTestResult.push_back(VclTestResult(aTestName, aTestStatus, aTestBitmap)); +} + +std::vector<VclTestResult>& GraphicsRenderTests::getTestResults() { return m_aTestResult; } + +OUString GraphicsRenderTests::getResultString() { + std::vector<int> testResults(4); + for (VclTestResult& test : m_aTestResult) + { + if (test.getStatus() == "PASSED") + { + testResults[0]++; + } + else if (test.getStatus() == "QUIRKY") + { + testResults[1]++; + } + else if (test.getStatus() == "FAILED") + { + testResults[2]++; + } + else + { + testResults[3]++; + } + } + OUString resultString = "Graphics Backend used: " + m_aCurGraphicsBackend + + "\nPassed Tests : " + OUString::number(testResults[0]) + + "\nQuirky Tests : " + OUString::number(testResults[1]) + + "\nFailed Tests : " + OUString::number(testResults[2]) + + "\nSkipped Tests : " + OUString::number(testResults[3]) + "\n"; + return resultString; +} + +void GraphicsRenderTests::run(bool storeResultBitmap) +{ + m_aStoreResultantBitmap = storeResultBitmap; 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) + std::unordered_map<OUString, std::vector<OUString>> aTests; + for (VclTestResult& tests : m_aTestResult) + { + aTests[tests.getStatus()].push_back(tests.getTestName()); + } + OUString writeResult = getResultString() + "\n---Name of the tests that failed---\n"; + if (static_cast<int>(aTests["FAILED"].size()) > 0) + { + for (const class OUString& tests : aTests["FAILED"]) { - logFile.WriteLine(tests); + writeResult += tests + "\n"; } } else { - logFile.WriteLine("No test has been failed."); + writeResult += "No test has been failed.\n"; } - logFile.WriteLine("\n---Name of the tests that were Quirky---"); - if (m_aQuirky.size() > 0) + writeResult += "\n---Name of the tests that were Quirky---\n"; + if (static_cast<int>(aTests["QUIRKY"].size()) > 0) { - for (const class OString& tests : m_aQuirky) + for (const class OUString& tests : aTests["QUIRKY"]) { - logFile.WriteLine(tests); + writeResult += tests + "\n"; } } else { - logFile.WriteLine("No test was Quirky."); + writeResult += "No test was Quirky.\n"; } - logFile.WriteLine("\n---Name of the tests that were Skipped---"); - if (m_aSkipped.size() > 0) + writeResult += "\n---Name of the tests that were Skipped---\n"; + if (static_cast<int>(aTests["SKIPPED"].size()) > 0) { - for (const class OString& tests : m_aSkipped) + for (const class OUString& tests : aTests["SKIPPED"]) { - logFile.WriteLine(tests); + writeResult += tests + "\n"; } } else { - logFile.WriteLine("No test was Skipped."); + writeResult += "No test was Skipped."; } + logFile.WriteOString(OUStringToOString(writeResult, RTL_TEXTENCODING_UTF8)); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits