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>
diff --git a/sd/qa/uitest/impress_tests2/tdf148810.py b/sd/qa/uitest/impress_tests2/tdf148810.py
deleted file mode 100755
index 6ae79b8..0000000
--- 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
similarity index 100%
rename from sd/qa/uitest/data/tdf148810_PARA_OUTLLEVEL.pptx
rename to 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 57d504a..e311087 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();