summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-01-30 16:34:09 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-01-30 18:23:57 +0000
commit2c99e7737ef2b536a4d9f28c3ddd37fe6afa9ceb (patch)
treedbd83e421231d37e8c5de6eae54e7a7241266dad /sd
parent7ba513361df3cdde639f80757a299721023d46a1 (diff)
tdf#148810: sd: move UItest to CppUnittest
Change-Id: I11c0ecfb628792ed0ce62916e01fe3b69cb0fc78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146363 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd')
-rwxr-xr-xsd/qa/uitest/impress_tests2/tdf148810.py54
-rw-r--r--sd/qa/unit/data/pptx/tdf148810_PARA_OUTLLEVEL.pptx (renamed from sd/qa/uitest/data/tdf148810_PARA_OUTLLEVEL.pptx)bin21210 -> 21210 bytes
-rw-r--r--sd/qa/unit/uiimpress.cxx31
3 files changed, 31 insertions, 54 deletions
diff --git a/sd/qa/uitest/impress_tests2/tdf148810.py b/sd/qa/uitest/impress_tests2/tdf148810.py
deleted file mode 100755
index 6ae79b8e1670..000000000000
--- a/sd/qa/uitest/impress_tests2/tdf148810.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
-#
-
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.framework import UITestCase
-
-
-class Tdf148810(UITestCase):
-
- def test_Tdf148810(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf148810_PARA_OUTLLEVEL.pptx")):
- document = self.ui_test.get_component()
-
- xDoc = self.xUITest.getTopFocusWindow()
- xEditWin = xDoc.getChild("impress_win")
-
- xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"TextShape 2"}))
-
- # type something to get into text editing mode (instead of shape selection).
- xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- #time.sleep(2)
-
- # get to the front of the text (behind the bullet point)
- xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
- # remove the numbering bullet point
- xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
-
- #xShape = xEditWin.getChild("TextShape 2")
- #print(xShape)
- #print(xShape.getChildren())
- #print(get_state_as_dict(xShape))
- #print(dir(xShape)
-
- xText = document.DrawPages[0].getByIndex(1).createEnumeration().nextElement()
- #print(xText)
- # this is the first numbering level (as opposed to either -1 or None for no numbering)
- self.assertEqual(0, xText.NumberingLevel)
- #time.sleep(2)
-
- self.xUITest.executeCommand(".uno:Undo")
- #time.sleep(2)
-
- xText = document.DrawPages[0].getByIndex(1).createEnumeration().nextElement()
- # This was failing with "None"
- self.assertEqual(0, xText.NumberingLevel)
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sd/qa/uitest/data/tdf148810_PARA_OUTLLEVEL.pptx b/sd/qa/unit/data/pptx/tdf148810_PARA_OUTLLEVEL.pptx
index b2f4a13da549..b2f4a13da549 100644
--- a/sd/qa/uitest/data/tdf148810_PARA_OUTLLEVEL.pptx
+++ b/sd/qa/unit/data/pptx/tdf148810_PARA_OUTLLEVEL.pptx
Binary files differ
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 57d504ae47b7..e311087673ab 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1114,6 +1114,37 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf153161)
CPPUNIT_ASSERT_EQUAL(sExpectedText, xShape->getString());
}
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf148810)
+{
+ createSdImpressDoc("pptx/tdf148810_PARA_OUTLLEVEL.pptx");
+
+ // type something to get into text editing mode (instead of shape selection).
+ insertStringToObject(1, u"x", /*bUseEscape*/ false);
+
+ auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+ typeKey(pXImpressDocument, KEY_HOME);
+
+ typeKey(pXImpressDocument, KEY_BACKSPACE);
+
+ uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(1, 0));
+ uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, xShape));
+ uno::Reference<beans::XPropertySet> xPropSet(xParagraph, uno::UNO_QUERY_THROW);
+ sal_Int16 nNumberingLevel = -1;
+ xPropSet->getPropertyValue("NumberingLevel") >>= nNumberingLevel;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nNumberingLevel);
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ nNumberingLevel = -1;
+ xPropSet->getPropertyValue("NumberingLevel") >>= nNumberingLevel;
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 0
+ // - Actual : -1
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nNumberingLevel);
+}
+
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696)
{
createSdImpressDoc();