Added a UI dialog box for running the VCL backend tests

The UI dialog box will allow the user to run the VCL graphics tests
and will allow them to view the results as well.

Change-Id: Ice289444ff425496a3e400a4c2bc06c307168c62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117384
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
homeboy445 2021-06-17 17:42:41 +05:30 committed by Tomaž Vajngerl
parent 7c95c16deb
commit df3ed584b0
16 changed files with 289 additions and 106 deletions

View file

@ -138,6 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/dialogs/pastedlg \
cui/source/dialogs/postdlg \
cui/source/dialogs/QrCodeGenDialog \
cui/source/dialogs/GraphicTestsDialog \
cui/source/dialogs/scriptdlg \
cui/source/dialogs/SignatureLineDialogBase \
cui/source/dialogs/SignatureLineDialog \

View file

@ -82,6 +82,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/gallerythemeiddialog \
cui/uiconfig/ui/gallerytitledialog \
cui/uiconfig/ui/galleryupdateprogress \
cui/uiconfig/ui/graphictestdlg \
cui/uiconfig/ui/hangulhanjaadddialog \
cui/uiconfig/ui/hangulhanjaeditdictdialog \
cui/uiconfig/ui/hangulhanjaconversiondialog \

View file

@ -0,0 +1,55 @@
/* -*- 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 <GraphicsTestsDialog.hxx>
GraphicsTestsDialog::GraphicsTestsDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/graphictestdlg.ui", "GraphicTestsDialog")
, m_xResultLog(m_xBuilder->weld_text_view("gptestresults"))
, m_xDownloadResults(m_xBuilder->weld_button("gptest_downld"))
{
m_xResultLog->set_text("Running tests...");
m_xDownloadResults->connect_clicked(LINK(this, GraphicsTestsDialog, HandleDownloadRequest));
runGraphicsTestandUpdateLog();
}
void GraphicsTestsDialog::runGraphicsTestandUpdateLog()
{
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)
{
writeResults += tests + " [SKIPPED]\n";
}
m_xResultLog->set_text(atemp + OStringToOUString(writeResults, RTL_TEXTENCODING_UTF8));
}
IMPL_STATIC_LINK_NOARG(GraphicsTestsDialog, HandleDownloadRequest, weld::Button&, void)
{
//TODO: Enter code for downloading the results to user's system.
}

View file

@ -64,6 +64,7 @@
#include <SignatureLineDialog.hxx>
#include <SignSignatureLineDialog.hxx>
#include <QrCodeGenDialog.hxx>
#include <GraphicsTestsDialog.hxx>
#include <SpellDialog.hxx>
#include <cfg.hxx>
#include <numpages.hxx>
@ -1694,6 +1695,13 @@ AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent)
std::make_unique<AboutDialog>(pParent));
}
VclPtr<VclAbstractDialog>
AbstractDialogFactory_Impl::CreateGraphicTestsDialog(weld::Window* pParent)
{
return VclPtr<CuiAbstractController_Impl>::Create(
std::make_unique<GraphicsTestsDialog>(pParent));
}
VclPtr<VclAbstractDialog>
AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent)
{

View file

@ -37,6 +37,7 @@
#include <cuitbxform.hxx>
#include <dlgname.hxx>
#include <DiagramDialog.hxx>
#include <GraphicsTestsDialog.hxx>
#include <hangulhanjadlg.hxx>
#include <hyphen.hxx>
#include <insdlg.hxx>
@ -951,6 +952,8 @@ public:
virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* pParent) override;
virtual VclPtr<VclAbstractDialog> CreateGraphicTestsDialog(weld::Window* pParent) override;
virtual VclPtr<VclAbstractDialog> CreateTipOfTheDayDialog(weld::Window* pParent) override;
virtual VclPtr<VclAbstractDialog> CreateToolbarmodeDialog(weld::Window* pParent) override;

View file

@ -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/.
*/
#pragma once
#include <vcl/weld.hxx>
#include <vcl/test/GraphicsRenderTests.hxx>
class GraphicsTestsDialog : public weld::GenericDialogController
{
std::unique_ptr<weld::TextView> m_xResultLog;
std::unique_ptr<weld::Button> m_xDownloadResults;
DECL_STATIC_LINK(GraphicsTestsDialog, HandleDownloadRequest, weld::Button&, void);
public:
GraphicsTestsDialog(weld::Window* pParent);
void runGraphicsTestandUpdateLog();
};

View file

@ -556,6 +556,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, m_xMousePosLB(m_xBuilder->weld_combo_box("mousepos"))
, m_xMouseMiddleLB(m_xBuilder->weld_combo_box("mousemiddle"))
, m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
, m_xRunGPTests(m_xBuilder->weld_button("btn_rungptest"))
{
if (Application::GetToolkitName().startsWith("gtk"))
m_xMenuIconBox->hide();
@ -590,12 +591,19 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
}
OfaViewTabPage::~OfaViewTabPage()
{
}
IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnRunGPTestClick, weld::Button&, void)
{
comphelper::dispatchCommand(".uno:GraphicTestDialog",{});
//Launch the Dialog box from here.
}
IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void)
{
css::uno::Sequence<css::beans::PropertyValue> aArgs(1);

View file

@ -114,10 +114,12 @@ private:
std::unique_ptr<weld::ComboBox> m_xMousePosLB;
std::unique_ptr<weld::ComboBox> m_xMouseMiddleLB;
std::unique_ptr<weld::Button> m_xMoreIcons;
std::unique_ptr<weld::Button> m_xRunGPTests;
DECL_LINK(OnAntialiasingToggled, weld::Toggleable&, void);
DECL_LINK(OnUseSkiaToggled, weld::Toggleable&, void);
DECL_STATIC_LINK(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void);
DECL_STATIC_LINK(OfaViewTabPage, OnRunGPTestClick, weld::Button&, void);
void UpdateSkiaStatus();
void HideSkiaWidgets();
void UpdateHardwareAccelStatus();

View file

@ -0,0 +1,113 @@
<?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="GraphicTestsDialog">
<property name="can-focus">False</property>
<property name="title" translatable="yes" context="graphictestdlg|GraphicTestsDialog">Run Graphics Tests</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default-width">500</property>
<property name="default-height">450</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="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="gptestbtnrun">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="gptest_downld">
<property name="label" translatable="yes" context="graphictestdlg|gptest_downld">Download Results</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<accelerator key="c" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="gptest_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes" context="graphictestdlg|gptest_label">Helps to determine the efficiency of LibreOffice's graphics rendering by running some tests under the hood and providing their results in the log.</property>
<property name="margin-start">400</property>
<property name="margin-top">10</property>
<property name="label" translatable="yes" context="graphictestdlg|gptest_label">What's this?</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="gptest_label1">
<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>
<accessibility>
<relation type="label-for" target="gptestresults"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="gpscrollerwindow1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="gptestresults">
<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>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.1 -->
<!-- Generated with glade 3.38.2 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="adjustment2">
@ -9,7 +9,7 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid" id="OptViewPage">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -18,7 +18,7 @@
<property name="border-width">6</property>
<property name="column-spacing">24</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=1 n-rows=4 -->
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -32,15 +32,15 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=2 n-rows=2 -->
<object class="GtkGrid" id="grid7">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="hexpand">True</property>
<property name="row-spacing">3</property>
<property name="column-spacing">6</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
@ -136,20 +136,20 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=1 n-rows=2 -->
<object class="GtkGrid" id="grid8">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-spacing">3</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="row-spacing">3</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid" id="menuiconsbox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="column-spacing">6</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
@ -192,12 +192,12 @@
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid" id="menushortcutsbpx">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="column-spacing">6</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkComboBoxText" id="contextmenushortcuts">
<property name="visible">True</property>
@ -260,15 +260,15 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=2 n-rows=3 -->
<object class="GtkGrid" id="refgrid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="hexpand">True</property>
<property name="row-spacing">3</property>
<property name="column-spacing">6</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<child>
<object class="GtkComboBoxText" id="notebookbariconsize">
<property name="visible">True</property>
@ -401,14 +401,14 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=3 n-rows=1 -->
<object class="GtkGrid" id="refgrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkComboBoxText" id="iconstyle">
<property name="visible">True</property>
@ -488,7 +488,7 @@
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=1 n-rows=3 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -500,14 +500,14 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=1 n-rows=6 -->
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes" context="optviewpage|grid3|tooltip_text">Requires restart</property>
<property name="row-spacing">3</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="row-spacing">3</property>
<child>
<object class="GtkCheckButton" id="useaccel">
<property name="label" translatable="yes" context="optviewpage|useaccel">Use hard_ware acceleration</property>
@ -602,48 +602,6 @@
<property name="top-attach">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="label">
@ -669,13 +627,13 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=1 n-rows=3 -->
<object class="GtkGrid" id="grid9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-spacing">3</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="row-spacing">3</property>
<child>
<object class="GtkCheckButton" id="showfontpreview">
<property name="label" translatable="yes" context="optviewpage|showfontpreview">Show p_review of fonts</property>
@ -717,7 +675,7 @@
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=1 -->
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -742,8 +700,8 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activates-default">True</property>
<property name="adjustment">adjustment2</property>
<property name="truncate-multiline">True</property>
<property name="adjustment">adjustment2</property>
<child internal-child="accessible">
<object class="AtkObject" id="aanf-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="extended_tip | aanf">Enter the smallest font size to apply antialiasing.</property>
@ -755,51 +713,12 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="label">
@ -818,6 +737,21 @@
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_rungptest">
<property name="label" translatable="yes" context="optviewpage|btn_rungptest">Run Graphics Tests</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>

View file

@ -146,6 +146,8 @@ public:
virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* _pParent) = 0;
virtual VclPtr<VclAbstractDialog> CreateGraphicTestsDialog(weld::Window* pParent) = 0;
virtual VclPtr<VclAbstractDialog> CreateTipOfTheDayDialog(weld::Window* _pParent) = 0;
virtual VclPtr<VclAbstractDialog> CreateToolbarmodeDialog(weld::Window* _pParent) = 0;

View file

@ -63,6 +63,7 @@ class SvxSearchItem;
#define SID_PRINTER_NAME (SID_SFX_START + 322)
#define SID_PRINTER_CHANGESTODOC (SID_SFX_START + 324)
#define SID_PRINTPREVIEW (SID_SFX_START + 325)
#define SID_GRAPHICTEST_DIALOG (SID_SFX_START + 326)
#define SID_MAIL_SUBJECT (SID_SFX_START + 328)
#define SID_MAIL_SENDDOC (SID_SFX_START + 331)

View file

@ -19,6 +19,7 @@
class VCL_PLUGIN_PUBLIC GraphicsRenderTests
{
public:
//For storing the results correspondingly to the tests.
std::vector<OString> m_aPassed;
std::vector<OString> m_aQuirky;
@ -28,6 +29,7 @@ class VCL_PLUGIN_PUBLIC GraphicsRenderTests
//For storing the current graphics Backend in use.
OUString m_aCurGraphicsBackend;
private:
void testDrawRectWithRectangle();
void testDrawRectWithPixel();
void testDrawRectWithLine();

View file

@ -25,6 +25,10 @@ interface Application
[
ExecMethod = MiscExec_Impl ;
]
SID_GRAPHICTEST_DIALOG
[
ExecMethod = MiscExec_Impl ;
]
SID_SETOPTIONS
[
ExecMethod = MiscExec_Impl ;

View file

@ -134,6 +134,22 @@ SfxVoidItem About SID_ABOUT
GroupId = SfxGroupId::Application;
]
SfxVoidItem GraphicTestDialog SID_GRAPHICTEST_DIALOG
()
[
AutoUpdate = FALSE,
FastCall = FALSE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = TRUE,
MenuConfig = TRUE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Application;
]
SfxVoidItem Activate SID_ACTIVATE
()

View file

@ -626,6 +626,15 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
break;
}
case SID_GRAPHICTEST_DIALOG:
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateGraphicTestsDialog(rReq.GetFrameWeld()));
pDlg->Execute();
bDone = true;
break;
}
case SID_TEMPLATE_MANAGER:
{
SfxTemplateManagerDlg aDialog(rReq.GetFrameWeld());