summaryrefslogtreecommitdiffstats
path: root/cui/qa
diff options
context:
space:
mode:
Diffstat (limited to 'cui/qa')
-rw-r--r--cui/qa/uitest/dialogs/chardlg.py21
-rw-r--r--cui/qa/uitest/dialogs/macroselectordlg.py44
-rw-r--r--cui/qa/uitest/dialogs/shortcuts.py1
-rw-r--r--cui/qa/uitest/tabpages/themepage.py87
-rw-r--r--cui/qa/uitest/tabpages/tpcolor.py69
-rw-r--r--cui/qa/unit/cui-dialogs-test.cxx7
-rw-r--r--cui/qa/unit/data/cui-dialogs-test.txt1
7 files changed, 126 insertions, 104 deletions
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
index 21a1582567a0..686cb6472ac8 100644
--- a/cui/qa/uitest/dialogs/chardlg.py
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -35,8 +35,8 @@ class Test(UITestCase):
xFontTransparency.executeAction("UP", tuple())
# Verify the result.
- drawPage = component.getDrawPages().getByIndex(0)
- shape = drawPage.getByIndex(0)
+ drawPage = component.getDrawPages()[0]
+ shape = drawPage[0]
# Without the accompanying fix in place, this test would have failed with:
# AssertionError: 100 != 5
@@ -54,7 +54,7 @@ class Test(UITestCase):
editWin = doc.getChild("impress_win")
# Set theme colors.
- drawPage = component.getDrawPages().getByIndex(0)
+ drawPage = component.getDrawPages()[0]
master = drawPage.MasterPage
theme = mkPropertyValues({
"Name": "nameA",
@@ -74,7 +74,7 @@ class Test(UITestCase):
0x000000, # folHlink
])
})
- master.Theme = theme
+ master.ThemeUnoRepresentation = theme
# Select the title shape.
editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
@@ -98,25 +98,25 @@ class Test(UITestCase):
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)
+ drawPage = component.getDrawPages()[0]
+ shape = drawPage[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 != 4
+ # AssertionError: -1 != 3
# i.e. no theme index was set, instead of accent1 (index into the above color scheme).
- self.assertEqual(portion.CharColorTheme, 4)
+ 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, 2000)
- self.assertEqual(portion.CharColorLumOff, 8000)
+ self.assertEqual(portion.CharColorLumMod, 5000)
+ self.assertEqual(portion.CharColorLumOff, 5000)
def testSvxCharEffectsPageWriter(self):
# Start Writer.
@@ -150,7 +150,6 @@ class Test(UITestCase):
# 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:
diff --git a/cui/qa/uitest/dialogs/macroselectordlg.py b/cui/qa/uitest/dialogs/macroselectordlg.py
new file mode 100644
index 000000000000..96ba11a2d888
--- /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/shortcuts.py b/cui/qa/uitest/dialogs/shortcuts.py
index 99d2bd1ccedc..ac8a0a791496 100644
--- a/cui/qa/uitest/dialogs/shortcuts.py
+++ b/cui/qa/uitest/dialogs/shortcuts.py
@@ -15,7 +15,6 @@ 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:
diff --git a/cui/qa/uitest/tabpages/themepage.py b/cui/qa/uitest/tabpages/themepage.py
deleted file mode 100644
index f85af965f626..000000000000
--- a/cui/qa/uitest/tabpages/themepage.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# 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 convert_property_values_to_dict
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict
-from uitest.uihelper.common import select_pos
-from uitest.uihelper.common import select_by_text
-
-# Test for cui/source/tabpages/themepage.cxx.
-class Test(UITestCase):
-
- def testThemePage(self):
- # Given an Impress document with a master page that has 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")
- 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.Theme = theme
-
- # When changing the name of the theme:
- self.xUITest.executeCommand(".uno:SlideMasterPage")
- with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- # Select RID_SVXPAGE_THEME.
- select_pos(xTabs, "3")
- themeName = xDialog.getChild("themeName")
- themeName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- themeName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- themeName.executeAction("TYPE", mkPropertyValues({"TEXT": "nameB"}))
- colorSetName = xDialog.getChild("colorSetName")
- colorSetName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- colorSetName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- colorSetName.executeAction("TYPE", mkPropertyValues({"TEXT": "colorSetB"}))
-
- # Select a custom accent1 color.
- accent1 = xDialog.getChild("btnAccent1")
- accent1.executeAction("OPENLIST", tuple())
- floatWindow = self.xUITest.getFloatWindow()
- paletteSelector = floatWindow.getChild("palette_listbox")
- select_by_text(paletteSelector, "chart-palettes")
- colorSet = floatWindow.getChild("colorset")
- colorSet.executeAction("CHOOSE", mkPropertyValues({"POS": "2"}))
-
- # Then make sure the doc model is updated accordingly:
- # Without the accompanying fix in place, this test would have failed with:
- # AssertionError: 'nameA' != 'nameB'
- # i.e. the UI didn't update the theme name.
- theme = convert_property_values_to_dict(master.Theme)
- self.assertEqual(theme["Name"], "nameB")
- # Without the accompanying fix in place, this test would have failed with:
- # AssertionError: 'colorSetA' != 'colorSetB'
- # i.e. the UI didn't update the color scheme name.
- self.assertEqual(theme["ColorSchemeName"], "colorSetB")
- colorSet = theme["ColorScheme"]
- # Without the accompanying fix in place, this test would have failed with:
- # AssertionError: 0 != 16728590 (#ff420e)
- # i.e. the UI didn't update the accent1 color from black to a custom value.
- self.assertEqual(colorSet[4], 0xff420e)
-
-
-# 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 000000000000..4e7b8261ff83
--- /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()[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[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
index f4f73facbaa6..88a1d9b09464 100644
--- a/cui/qa/unit/cui-dialogs-test.cxx
+++ b/cui/qa/unit/cui-dialogs-test.cxx
@@ -50,15 +50,14 @@ 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"] = 0;
- rKnownDialogs["cui/ui/textdialog.ui"] = 1;
+ rKnownDialogs["cui/ui/formatcellsdialog.ui"_ostr] = 0;
+ rKnownDialogs["cui/ui/textdialog.ui"_ostr] = 1;
}
VclPtr<VclAbstractDialog> CuiDialogsTest::createDialogByID(sal_uInt32 nID)
@@ -69,7 +68,7 @@ VclPtr<VclAbstractDialog> CuiDialogsTest::createDialogByID(sal_uInt32 nID)
{
case 0: // "cui/ui/formatcellsdialog.ui"
{
- pReturnDialog = mpFact->CreateSvxFormatCellsDialog(nullptr, mxAttr.get(), *mxModel);
+ pReturnDialog = mpFact->CreateSvxFormatCellsDialog(nullptr, *mxAttr, *mxModel, true);
break;
}
diff --git a/cui/qa/unit/data/cui-dialogs-test.txt b/cui/qa/unit/data/cui-dialogs-test.txt
index cb176088446c..7a8e55240c93 100644
--- a/cui/qa/unit/data/cui-dialogs-test.txt
+++ b/cui/qa/unit/data/cui-dialogs-test.txt
@@ -53,7 +53,6 @@ cui/ui/textdialog.ui
cui/ui/aboutconfigdialog.ui
-cui/ui/aboutconfigvaluedialog.ui
cui/ui/aboutdialog.ui
cui/ui/accelconfigpage.ui
cui/ui/acorexceptpage.ui