From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- cui/qa/uitest/dialogs/chardlg.py | 167 ++++++++++++++++++++++++++++++ cui/qa/uitest/dialogs/macroselectordlg.py | 44 ++++++++ cui/qa/uitest/dialogs/pastedlg.py | 43 ++++++++ cui/qa/uitest/dialogs/shortcuts.py | 39 +++++++ cui/qa/uitest/tabpages/tpcolor.py | 69 ++++++++++++ cui/qa/unit/cui-dialogs-test.cxx | 101 ++++++++++++++++++ cui/qa/unit/cui-dialogs-test_2.cxx | 58 +++++++++++ cui/qa/unit/cui-dialogs-test_3.cxx | 58 +++++++++++ cui/qa/unit/cui-dialogs-test_4.cxx | 58 +++++++++++ cui/qa/unit/data/cui-dialogs-test.txt | 95 +++++++++++++++++ cui/qa/unit/data/cui-dialogs-test_2.txt | 61 +++++++++++ cui/qa/unit/data/cui-dialogs-test_3.txt | 43 ++++++++ cui/qa/unit/data/cui-dialogs-test_4.txt | 72 +++++++++++++ 13 files changed, 908 insertions(+) create mode 100644 cui/qa/uitest/dialogs/chardlg.py create mode 100644 cui/qa/uitest/dialogs/macroselectordlg.py create mode 100644 cui/qa/uitest/dialogs/pastedlg.py create mode 100644 cui/qa/uitest/dialogs/shortcuts.py create mode 100644 cui/qa/uitest/tabpages/tpcolor.py create mode 100644 cui/qa/unit/cui-dialogs-test.cxx create mode 100644 cui/qa/unit/cui-dialogs-test_2.cxx create mode 100644 cui/qa/unit/cui-dialogs-test_3.cxx create mode 100644 cui/qa/unit/cui-dialogs-test_4.cxx create mode 100644 cui/qa/unit/data/cui-dialogs-test.txt create mode 100644 cui/qa/unit/data/cui-dialogs-test_2.txt create mode 100644 cui/qa/unit/data/cui-dialogs-test_3.txt create mode 100644 cui/qa/unit/data/cui-dialogs-test_4.txt (limited to 'cui/qa') diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py new file mode 100644 index 0000000000..d6ebffac3e --- /dev/null +++ b/cui/qa/uitest/dialogs/chardlg.py @@ -0,0 +1,167 @@ +# +# 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/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text + +# Test for cui/source/tabpages/chardlg.cxx. +class Test(UITestCase): + + def testSvxCharEffectsPage(self): + # Start Impress. + with self.ui_test.create_doc_in_start_center("impress") as component: + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("impress_win") + # Select the title shape. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") + + # Now use Format -> Character. + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + for _ in range(5): + xFontTransparency.executeAction("UP", tuple()) + + # Verify the result. + drawPage = component.getDrawPages()[0] + shape = drawPage[0] + + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 100 != 5 + # i.e. the dialog did not set transparency to 5%, instead it left the character color at + # COL_AUTO. + self.assertEqual(shape.CharTransparence, 5) + + def testSvxCharEffectsPageTheme(self): + # Given a document with a document theme: + # Start Impress. + with self.ui_test.create_doc_in_start_center("impress") as component: + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("impress_win") + + # Set theme colors. + drawPage = component.getDrawPages().getByIndex(0) + master = drawPage.MasterPage + theme = mkPropertyValues({ + "Name": "nameA", + "ColorSchemeName": "colorSetA", + "ColorScheme": tuple([ + 0x000000, # dk1 + 0x000000, # lt1 + 0x000000, # dk2 + 0x000000, # lt2 + 0x000000, # accent1 + 0x000000, # accent2 + 0x000000, # accent3 + 0x000000, # accent4 + 0x000000, # accent5 + 0x000000, # accent6 + 0x000000, # hlink + 0x000000, # folHlink + ]) + }) + master.ThemeUnoRepresentation = theme + + # Select the title shape. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") + + # Now use Format -> Character. + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + + # When setting the shape text color to accent 1: + accent1 = xDialog.getChild("fontcolorlb") + accent1.executeAction("OPENLIST", tuple()) + floatWindow = self.xUITest.getFloatWindow() + paletteSelector = floatWindow.getChild("palette_listbox") + select_by_text(paletteSelector, "Theme colors") + colorSet = floatWindow.getChild("colorset") + # 4 would be accent1, +12 is the first from the effect variants. + colorSet.executeAction("CHOOSE", mkPropertyValues({"POS": "16"})) + + # Then make sure the doc model has the correct color theme index: + drawPage = component.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + paragraphs = shape.createEnumeration() + paragraph = paragraphs.nextElement() + portions = paragraph.createEnumeration() + portion = portions.nextElement() + + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: -1 != 3 + # i.e. no theme index was set, instead of accent1 (index into the above color scheme). + self.assertEqual(portion.CharColorTheme, 3) + + # Then make sure that '80% lighter' is lum-mod=2000 and lum-off=8000: + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 10000 != 2000 + # i.e. the effects where not applied, luminance modulation was the default instead of a + # custom value. + self.assertEqual(portion.CharColorLumMod, 5000) + self.assertEqual(portion.CharColorLumOff, 5000) + + def testSvxCharEffectsPageWriter(self): + # Start Writer. + with self.ui_test.create_doc_in_start_center("writer") as component: + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("writer_edit") + # Type a character and select it. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") + + # Now use Format -> Character. + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 'false' != 'true' + # i.e. the transparency widget was hidden. + self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true") + for _ in range(5): + xFontTransparency.executeAction("UP", tuple()) + + # Verify the result. + paragraph = component.Text.createEnumeration().nextElement() + + self.assertEqual(paragraph.CharTransparence, 5) + + def testSvxCharEffectsPageWriterAutomatic(self): + # Start Writer. + with self.ui_test.create_doc_in_start_center("writer"): + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("writer_edit") + + # Use Format -> Character. + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontColorLB = xDialog.getChild("fontcolorlb") + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 'White' != 'Automatic' + # i.e. the auto color lost its alpha component and appeared as white. + self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/uitest/dialogs/macroselectordlg.py b/cui/qa/uitest/dialogs/macroselectordlg.py new file mode 100644 index 0000000000..96ba11a2d8 --- /dev/null +++ b/cui/qa/uitest/dialogs/macroselectordlg.py @@ -0,0 +1,44 @@ +# +# 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/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +class tdf145978(UITestCase): + def test_tdf145978(self): + with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as xDialog: + xCategoriesTree = xDialog.getChild("categories") + xCategoriesTreeEntry = xCategoriesTree.getChild('1') #Application Macros + xCategoriesTreeEntry.executeAction("EXPAND", tuple()) + + xSubCategoriesTreeEntry = None + for i in xCategoriesTreeEntry.getChildren(): + xChild = xCategoriesTreeEntry.getChild(i) + if get_state_as_dict(xChild)["Text"] == "HelloWorld": + xSubCategoriesTreeEntry = xChild + break + + xSubCategoriesTreeEntry.executeAction("SELECT", tuple()) + + xCommandsTree = xDialog.getChild("commands") + + xCommandsTreeEntry = None + for i in xCommandsTree.getChildren(): + xChild = xCommandsTree.getChild(i) + if get_state_as_dict(xChild)["Text"] == "HelloWorldPython": + xCommandsTreeEntry = xChild + break + + xCommandsTreeEntry.executeAction("SELECT", tuple()) + + #Verify the dialog reloads with previous run macro selected + with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as xDialog: + xTree = xDialog.getChild("categories") + self.assertEqual("HelloWorld", get_state_as_dict(xTree)["SelectEntryText"]) + xTree = xDialog.getChild("commands") + self.assertEqual("HelloWorldPython", get_state_as_dict(xTree)["SelectEntryText"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/uitest/dialogs/pastedlg.py b/cui/qa/uitest/dialogs/pastedlg.py new file mode 100644 index 0000000000..50a39d232f --- /dev/null +++ b/cui/qa/uitest/dialogs/pastedlg.py @@ -0,0 +1,43 @@ +# +# 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/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + + +# Test for SvPasteObjectDialog. +class Test(UITestCase): + + def testGetFormat(self): + # Copy a string in Impress. + with self.ui_test.create_doc_in_start_center("impress"): + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("impress_win") + # Select the title shape. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + # Now use paste special to see what formats are offered. + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial", close_button="cancel") as pasteSpecial: + formats = pasteSpecial.getChild("list") + entryCount = int(get_state_as_dict(formats)["Children"]) + items = [] + for index in range(entryCount): + entry = formats.getChild(str(index)) + entry.executeAction("SELECT", tuple()) + items.append(get_state_as_dict(formats)["SelectEntryText"]) + + # Make sure there is no RTF vs Richtext duplication. + self.assertTrue("Rich text formatting (RTF)" in items) + self.assertFalse("Rich text formatting (Richtext)" in items) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/uitest/dialogs/shortcuts.py b/cui/qa/uitest/dialogs/shortcuts.py new file mode 100644 index 0000000000..99d2bd1cce --- /dev/null +++ b/cui/qa/uitest/dialogs/shortcuts.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class Test(UITestCase): + + def test_tab_navigation(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + for i in range(16): + self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i)) + + xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEDOWN"})) + + self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], "0") + + for i in reversed(range(16)): + xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEUP"})) + + self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i)) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/uitest/tabpages/tpcolor.py b/cui/qa/uitest/tabpages/tpcolor.py new file mode 100644 index 0000000000..820ffa634e --- /dev/null +++ b/cui/qa/uitest/tabpages/tpcolor.py @@ -0,0 +1,69 @@ +# +# 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/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text + + +# Test for cui/source/tabpages/tpcolor.cxx. +class Test(UITestCase): + + def testSvxColorTabPageTheme(self): + # Given an Impress document with a theme: + with self.ui_test.create_doc_in_start_center("impress") as component: + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("impress_win") + # Set theme colors. + drawPage = component.getDrawPages().getByIndex(0) + master = drawPage.MasterPage + theme = mkPropertyValues({ + "Name": "nameA", + "ColorSchemeName": "colorSetA", + "ColorScheme": tuple([ + 0x000000, # dk1 + 0x000000, # lt1 + 0x000000, # dk2 + 0x000000, # lt2 + 0x0000ff, # accent1 + 0x000000, # accent2 + 0x000000, # accent3 + 0x000000, # accent4 + 0x000000, # accent5 + 0x000000, # accent6 + 0x000000, # hlink + 0x000000, # folHlink + ]) + }) + master.ThemeUnoRepresentation = theme + # Select the title shape. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + + # When using right click -> Area to refer to a theme for shape fill: + with self.ui_test.execute_dialog_through_command(".uno:FormatArea") as xDialog: + tabControl = xDialog.getChild("tabcontrol") + # Area + select_pos(tabControl, "0") + # Color + btnColor = xDialog.getChild("btncolor") + btnColor.executeAction("CLICK", tuple()) + paletteSelector = xDialog.getChild("paletteselector") + select_by_text(paletteSelector, "Theme colors") + colorSelector = xDialog.getChild("colorset") + colorSelector.executeAction("CHOOSE", mkPropertyValues({"POS": "4"})) + + # Then make sure the doc model is updated accordingly: + shape = drawPage.getByIndex(0) + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: -1 != 3 + # i.e. the theme metadata of the selected fill color was lost. + self.assertEqual(shape.FillColorTheme, 3) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/unit/cui-dialogs-test.cxx b/cui/qa/unit/cui-dialogs-test.cxx new file mode 100644 index 0000000000..a6f0b01d1e --- /dev/null +++ b/cui/qa/unit/cui-dialogs-test.cxx @@ -0,0 +1,101 @@ +/* -*- 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 +#include +#include +#include +#include + +using namespace ::com::sun::star; + +/// Test opening a dialog in cui +class CuiDialogsTest : public ScreenshotTest +{ +private: + std::unique_ptr mxModel; + std::unique_ptr mxAttr; + SvxAbstractDialogFactory* mpFact; + + void initialize(); + + /// helper method to populate KnownDialogs, called in setUp(). Needs to be + /// written and has to add entries to KnownDialogs + virtual void registerKnownDialogsByID(mapType& rKnownDialogs) override; + + /// dialog creation for known dialogs by ID. Has to be implemented for + /// each registered known dialog + virtual VclPtr createDialogByID(sal_uInt32 nID) override; + +public: + CuiDialogsTest(); + + // try to open a dialog + void openAnyDialog(); + + CPPUNIT_TEST_SUITE(CuiDialogsTest); + CPPUNIT_TEST(openAnyDialog); + CPPUNIT_TEST_SUITE_END(); +}; + +CuiDialogsTest::CuiDialogsTest() {} + +void CuiDialogsTest::initialize() +{ + mpFact = SvxAbstractDialogFactory::Create(); + mxModel.reset(new SdrModel(nullptr, nullptr, true)); + mxModel->GetItemPool().FreezeIdRanges(); + mxAttr.reset(new SfxItemSet(mxModel->GetItemPool())); +} + +void CuiDialogsTest::registerKnownDialogsByID(mapType& rKnownDialogs) +{ + // fill map of known dialogs + rKnownDialogs["cui/ui/formatcellsdialog.ui"_ostr] = 0; + rKnownDialogs["cui/ui/textdialog.ui"_ostr] = 1; +} + +VclPtr CuiDialogsTest::createDialogByID(sal_uInt32 nID) +{ + VclPtr pReturnDialog; + + switch (nID) + { + case 0: // "cui/ui/formatcellsdialog.ui" + { + pReturnDialog = mpFact->CreateSvxFormatCellsDialog(nullptr, *mxAttr, *mxModel, true); + break; + } + + case 1: // "cui/ui/textdialog.ui" + { + pReturnDialog = mpFact->CreateTextTabDialog(nullptr, mxAttr.get(), nullptr); + break; + } + + default: + break; + } + + return pReturnDialog; +} + +void CuiDialogsTest::openAnyDialog() +{ + initialize(); + + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test.txt"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/qa/unit/cui-dialogs-test_2.cxx b/cui/qa/unit/cui-dialogs-test_2.cxx new file mode 100644 index 0000000000..5d98650fd8 --- /dev/null +++ b/cui/qa/unit/cui-dialogs-test_2.cxx @@ -0,0 +1,58 @@ +/* -*- 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 +#include +#include + +using namespace ::com::sun::star; + +/// Test opening a dialog in cui +class CuiDialogsTest2 : public ScreenshotTest +{ +private: + /// helper method to populate KnownDialogs, called in setUp(). Needs to be + /// written and has to add entries to KnownDialogs + virtual void registerKnownDialogsByID(mapType& rKnownDialogs) override; + + /// dialog creation for known dialogs by ID. Has to be implemented for + /// each registered known dialog + virtual VclPtr createDialogByID(sal_uInt32 nID) override; + +public: + CuiDialogsTest2(); + + // try to open a dialog + void openAnyDialog(); + + CPPUNIT_TEST_SUITE(CuiDialogsTest2); + CPPUNIT_TEST(openAnyDialog); + CPPUNIT_TEST_SUITE_END(); +}; + +CuiDialogsTest2::CuiDialogsTest2() {} + +void CuiDialogsTest2::registerKnownDialogsByID(mapType& /*rKnownDialogs*/) +{ + // leave empty should be in CuiDialogTest if any +} + +VclPtr CuiDialogsTest2::createDialogByID(sal_uInt32 /*nID*/) { return nullptr; } + +void CuiDialogsTest2::openAnyDialog() +{ + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test_2.txt"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest2); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/qa/unit/cui-dialogs-test_3.cxx b/cui/qa/unit/cui-dialogs-test_3.cxx new file mode 100644 index 0000000000..ebd1948854 --- /dev/null +++ b/cui/qa/unit/cui-dialogs-test_3.cxx @@ -0,0 +1,58 @@ +/* -*- 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 +#include +#include + +using namespace ::com::sun::star; + +/// Test opening a dialog in cui +class CuiDialogsTest3 : public ScreenshotTest +{ +private: + /// helper method to populate KnownDialogs, called in setUp(). Needs to be + /// written and has to add entries to KnownDialogs + virtual void registerKnownDialogsByID(mapType& rKnownDialogs) override; + + /// dialog creation for known dialogs by ID. Has to be implemented for + /// each registered known dialog + virtual VclPtr createDialogByID(sal_uInt32 nID) override; + +public: + CuiDialogsTest3(); + + // try to open a dialog + void openAnyDialog(); + + CPPUNIT_TEST_SUITE(CuiDialogsTest3); + CPPUNIT_TEST(openAnyDialog); + CPPUNIT_TEST_SUITE_END(); +}; + +CuiDialogsTest3::CuiDialogsTest3() {} + +void CuiDialogsTest3::registerKnownDialogsByID(mapType& /*rKnownDialogs*/) +{ + // leave empty should be in CuiDialogTest if any +} + +VclPtr CuiDialogsTest3::createDialogByID(sal_uInt32 /*nID*/) { return nullptr; } + +void CuiDialogsTest3::openAnyDialog() +{ + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test_3.txt"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest3); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/qa/unit/cui-dialogs-test_4.cxx b/cui/qa/unit/cui-dialogs-test_4.cxx new file mode 100644 index 0000000000..157ffa8b37 --- /dev/null +++ b/cui/qa/unit/cui-dialogs-test_4.cxx @@ -0,0 +1,58 @@ +/* -*- 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 +#include +#include + +using namespace ::com::sun::star; + +/// Test opening a dialog in cui +class CuiDialogsTest4 : public ScreenshotTest +{ +private: + /// helper method to populate KnownDialogs, called in setUp(). Needs to be + /// written and has to add entries to KnownDialogs + virtual void registerKnownDialogsByID(mapType& rKnownDialogs) override; + + /// dialog creation for known dialogs by ID. Has to be implemented for + /// each registered known dialog + virtual VclPtr createDialogByID(sal_uInt32 nID) override; + +public: + CuiDialogsTest4(); + + // try to open a dialog + void openAnyDialog(); + + CPPUNIT_TEST_SUITE(CuiDialogsTest4); + CPPUNIT_TEST(openAnyDialog); + CPPUNIT_TEST_SUITE_END(); +}; + +CuiDialogsTest4::CuiDialogsTest4() {} + +void CuiDialogsTest4::registerKnownDialogsByID(mapType& /*rKnownDialogs*/) +{ + // leave empty should be in CuiDialogTest if any +} + +VclPtr CuiDialogsTest4::createDialogByID(sal_uInt32 /*nID*/) { return nullptr; } + +void CuiDialogsTest4::openAnyDialog() +{ + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile(u"cui/qa/unit/data/cui-dialogs-test_4.txt"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest4); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/qa/unit/data/cui-dialogs-test.txt b/cui/qa/unit/data/cui-dialogs-test.txt new file mode 100644 index 0000000000..7a8e55240c --- /dev/null +++ b/cui/qa/unit/data/cui-dialogs-test.txt @@ -0,0 +1,95 @@ +# -*- 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/. +# + +# This file contains all dialogs that the unit tests in the module +# will work on if it is in script mode. It will read one-by-one, +# try to open it and create a screenshot that will be saved in +# workdir/screenshots using the pattern of the ui-file name. +# +# Syntax: +# - empty lines are allowed +# - lines starting with '#' are treated as comment +# - all other lines should contain a *.ui filename in the same +# notation as in the dialog constructors (see code) + +# +# The 'known' dialogs which have a hard-coded representation +# in registerKnownDialogsByID/createDialogByID +# + +cui/ui/formatcellsdialog.ui +cui/ui/textdialog.ui + +# +# Dialogs without a hard-coded representation. These will +# be visualized using a fallback based on weld::Builder +# + +# currently deactivated, leads to problems and the test to not work +# This is typically a hint that these should be hard-coded in the +# test case since they need some document and model data to work +# +# cui/ui/imagetabpage.ui +# cui/ui/connpooloptions.ui <- not calling DriverListControl::Init for +# ConnectionPoolOptionsPage::m_pDriverList leaves its BrowseBox::mvCols empty, causing "implicit +# conversion from type 'int' of value -1 (32-bit, signed) to type 'sal_uInt16' (aka 'unsigned +# short') changed the value to 65535 (16-bit, unsigned)" when calling +# GetColumnId( static_cast(mvCols.size()) - 1 ); +# in BrowseBox::AutoSizeLastColumn (svtools/source/brwbox/brwbox1.cxx) with Clang +# -fsanitize=implicit-signed-integer-truncation +# cui/ui/thesaurus.ui <- problems under Linux + +# this is part 1. in order to help the build time when building all +# lang, the list of ui is split in multiple parts to balance the run time +# or all the tests, which improve the overall elapsed time +# of make screenshot on big machines +# covering a to e + + +cui/ui/aboutconfigdialog.ui +cui/ui/aboutdialog.ui +cui/ui/accelconfigpage.ui +cui/ui/acorexceptpage.ui +cui/ui/acoroptionspage.ui +cui/ui/acorreplacepage.ui +cui/ui/agingdialog.ui +cui/ui/applyautofmtpage.ui +cui/ui/applylocalizedpage.ui +cui/ui/areadialog.ui +cui/ui/areatabpage.ui +cui/ui/asiantypography.ui +cui/ui/assigncomponentdialog.ui +cui/ui/autocorrectdialog.ui +cui/ui/baselinksdialog.ui +cui/ui/borderareatransparencydialog.ui +cui/ui/borderbackgrounddialog.ui +cui/ui/borderpage.ui +cui/ui/breaknumberoption.ui +cui/ui/calloutdialog.ui +cui/ui/calloutpage.ui +cui/ui/cellalignment.ui +cui/ui/certdialog.ui +cui/ui/charnamepage.ui +cui/ui/colorconfigwin.ui +cui/ui/colorpage.ui +cui/ui/colorpickerdialog.ui +cui/ui/comment.ui +cui/ui/connectortabpage.ui +cui/ui/croppage.ui +cui/ui/cuiimapdlg.ui +cui/ui/customizedialog.ui +cui/ui/databaselinkdialog.ui +cui/ui/dbregisterpage.ui +cui/ui/dimensionlinestabpage.ui +cui/ui/editdictionarydialog.ui +cui/ui/editmodulesdialog.ui +cui/ui/effectspage.ui +cui/ui/embossdialog.ui +cui/ui/eventassigndialog.ui +cui/ui/eventassignpage.ui diff --git a/cui/qa/unit/data/cui-dialogs-test_2.txt b/cui/qa/unit/data/cui-dialogs-test_2.txt new file mode 100644 index 0000000000..bccb005632 --- /dev/null +++ b/cui/qa/unit/data/cui-dialogs-test_2.txt @@ -0,0 +1,61 @@ +# -*- 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/. +# + +# See cui-dialogs-test.txt for explanations + +# covering f to n + +cui/ui/eventsconfigpage.ui +cui/ui/fmsearchdialog.ui +cui/ui/galleryapplyprogress.ui +cui/ui/galleryfilespage.ui +cui/ui/gallerygeneralpage.ui +cui/ui/gallerysearchprogress.ui +cui/ui/gallerythemedialog.ui +cui/ui/gallerythemeiddialog.ui +cui/ui/gallerytitledialog.ui +cui/ui/galleryupdateprogress.ui +cui/ui/gradientpage.ui +cui/ui/hangulhanjaadddialog.ui +cui/ui/hangulhanjaconversiondialog.ui +cui/ui/hangulhanjaeditdictdialog.ui +cui/ui/hangulhanjaoptdialog.ui +cui/ui/hatchpage.ui +cui/ui/hyperlinkdialog.ui +cui/ui/hyperlinkdocpage.ui +cui/ui/hyperlinkinternetpage.ui +cui/ui/hyperlinkmailpage.ui +cui/ui/hyperlinkmarkdialog.ui +cui/ui/hyperlinknewdocpage.ui +cui/ui/hyphenate.ui +cui/ui/iconchangedialog.ui +cui/ui/iconselectordialog.ui +cui/ui/insertfloatingframe.ui +cui/ui/insertoleobject.ui +cui/ui/insertrowcolumn.ui +cui/ui/javaclasspathdialog.ui +cui/ui/javastartparametersdialog.ui +cui/ui/linedialog.ui +cui/ui/lineendstabpage.ui +cui/ui/linestyletabpage.ui +cui/ui/linetabpage.ui +cui/ui/macroassigndialog.ui +cui/ui/macroassignpage.ui +cui/ui/macroselectordialog.ui +cui/ui/menuassignpage.ui +cui/ui/mosaicdialog.ui +cui/ui/movemenu.ui +cui/ui/multipathdialog.ui +cui/ui/namedialog.ui +cui/ui/newlibdialog.ui +cui/ui/newtabledialog.ui +cui/ui/newtoolbardialog.ui +cui/ui/numberingformatpage.ui +cui/ui/numberingoptionspage.ui +cui/ui/numberingpositionpage.ui diff --git a/cui/qa/unit/data/cui-dialogs-test_3.txt b/cui/qa/unit/data/cui-dialogs-test_3.txt new file mode 100644 index 0000000000..f2f0491ff5 --- /dev/null +++ b/cui/qa/unit/data/cui-dialogs-test_3.txt @@ -0,0 +1,43 @@ +# -*- 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/. +# + +# See cui-dialogs-test.txt for explanations + +# covering o + +cui/ui/objectnamedialog.ui +cui/ui/objecttitledescdialog.ui +cui/ui/optaccessibilitypage.ui +cui/ui/optadvancedpage.ui +cui/ui/optappearancepage.ui +cui/ui/optasianpage.ui +cui/ui/optbasicidepage.ui +cui/ui/optchartcolorspage.ui +cui/ui/optctlpage.ui +cui/ui/optemailpage.ui +cui/ui/optfltrembedpage.ui +cui/ui/optfltrpage.ui +cui/ui/optfontspage.ui +cui/ui/optgeneralpage.ui +cui/ui/opthtmlpage.ui +cui/ui/optionsdialog.ui +cui/ui/optionsdialog.ui +cui/ui/optjsearchpage.ui +cui/ui/optlanguagespage.ui +cui/ui/optlingupage.ui +cui/ui/optnewdictionarydialog.ui +cui/ui/optonlineupdatepage.ui +cui/ui/optopenclpage.ui +cui/ui/optpathspage.ui +cui/ui/optproxypage.ui +cui/ui/optsavepage.ui +cui/ui/optsecuritypage.ui +cui/ui/optuserpage.ui +cui/ui/optviewpage.ui + diff --git a/cui/qa/unit/data/cui-dialogs-test_4.txt b/cui/qa/unit/data/cui-dialogs-test_4.txt new file mode 100644 index 0000000000..a537b2b09d --- /dev/null +++ b/cui/qa/unit/data/cui-dialogs-test_4.txt @@ -0,0 +1,72 @@ +# -*- 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/. +# + +# See cui-dialogs-test.txt for explanations + +# covering p to z + +cui/ui/pageformatpage.ui +cui/ui/paragalignpage.ui +cui/ui/paraindentspacing.ui +cui/ui/paratabspage.ui +cui/ui/password.ui +cui/ui/pastespecial.ui +cui/ui/percentdialog.ui +cui/ui/personalization_tab.ui +cui/ui/pickbulletpage.ui +cui/ui/pickgraphicpage.ui +cui/ui/picknumberingpage.ui +cui/ui/pickoutlinepage.ui +cui/ui/positionpage.ui +cui/ui/positionsizedialog.ui +cui/ui/possizetabpage.ui +cui/ui/posterdialog.ui +cui/ui/querychangelineenddialog.ui +cui/ui/querydeletebitmapdialog.ui +cui/ui/querydeletechartcolordialog.ui +cui/ui/querydeletecolordialog.ui +cui/ui/querydeletedictionarydialog.ui +cui/ui/querydeletegradientdialog.ui +cui/ui/querydeletehatchdialog.ui +cui/ui/querydeletelineenddialog.ui +cui/ui/querydeletelinestyledialog.ui +cui/ui/queryduplicatedialog.ui +cui/ui/querynoloadedfiledialog.ui +cui/ui/querynosavefiledialog.ui +cui/ui/querysavelistdialog.ui +cui/ui/queryupdategalleryfilelistdialog.ui +cui/ui/recordnumberdialog.ui +cui/ui/rotationtabpage.ui +cui/ui/scriptorganizer.ui +cui/ui/searchattrdialog.ui +cui/ui/searchformatdialog.ui +cui/ui/securityoptionsdialog.ui +cui/ui/selectpathdialog.ui +cui/ui/shadowtabpage.ui +cui/ui/showcoldialog.ui +cui/ui/similaritysearchdialog.ui +cui/ui/slantcornertabpage.ui +cui/ui/smarttagoptionspage.ui +cui/ui/smoothdialog.ui +cui/ui/solarizedialog.ui +cui/ui/specialcharacters.ui +cui/ui/spellingdialog.ui +cui/ui/spelloptionsdialog.ui +cui/ui/splitcellsdialog.ui +cui/ui/storedwebconnectiondialog.ui +cui/ui/swpossizepage.ui +cui/ui/textanimtabpage.ui +cui/ui/textattrtabpage.ui +cui/ui/textflowpage.ui +cui/ui/transparencytabpage.ui +cui/ui/tsaurldialog.ui +cui/ui/twolinespage.ui +cui/ui/wordcompletionpage.ui +cui/ui/zoomdialog.ui + -- cgit v1.2.3