sd/qa/uitest/impress_tests2/tdf153161.py |   37 -------------------------------
 sd/qa/unit/uiimpress.cxx                 |   23 +++++++++++++++++++
 2 files changed, 23 insertions(+), 37 deletions(-)

New commits:
commit 40d76def20bc3ae5ab7db88fef2688ce1664fa15
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Jan 26 09:49:15 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jan 26 10:38:10 2023 +0000

    tdf#153161: sd: move UItest to CppUnittest
    
    Change-Id: I14c1bc76b6cf19e287ef57a0aa5f34d842c69309
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146163
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/qa/uitest/impress_tests2/tdf153161.py 
b/sd/qa/uitest/impress_tests2/tdf153161.py
deleted file mode 100644
index db14d7986f5b..000000000000
--- a/sd/qa/uitest/impress_tests2/tdf153161.py
+++ /dev/null
@@ -1,37 +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 libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
-
-class TestTdf153161(UITestCase):
-
-    def testTdf153161(self):
-        url = get_url_for_data_file('tdf153161_FlushToSave.odp')
-
-        with self.ui_test.load_file(url) as document:
-            oldText = document.DrawPages[0].getByIndex(1).String
-            self.assertTrue(oldText.startswith('在没有版本控制系统的时期'))
-
-            xImpressDoc = self.xUITest.getTopFocusWindow()
-            xEditWin = xImpressDoc.getChild('impress_win')
-            xEditWin.executeAction('SELECT', 
mkPropertyValues({'OBJECT':'Unnamed Drawinglayer object 1'}))
-
-            # Type something, getting into text editing mode (appending) 
automatically
-            xEditWin.executeAction('TYPE', mkPropertyValues({'TEXT': 'Foo 
Bar'}))
-            xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
-            xToolkit.processEventsToIdle()
-            self.xUITest.executeCommand('.uno:Save')
-
-        # Reload and check that the edit was saved
-        with self.ui_test.load_file(url) as document:
-            self.assertEqual(oldText + 'Foo Bar', 
document.DrawPages[0].getByIndex(1).String)
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sd/qa/uitest/data/tdf153161_FlushToSave.odp 
b/sd/qa/unit/data/odp/tdf153161_FlushToSave.odp
similarity index 100%
rename from sd/qa/uitest/data/tdf153161_FlushToSave.odp
rename to sd/qa/unit/data/odp/tdf153161_FlushToSave.odp
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 5655e58c0700..57d504ae47b7 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1091,6 +1091,29 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testFillColorNoColor)
     pDispatcher->ExecuteList(SID_ATTR_FILL_COLOR, SfxCallMode::RECORD, { 
&aXFillStyleItem });
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf153161)
+{
+    createSdImpressDoc("odp/tdf153161_FlushToSave.odp");
+
+    uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                                 uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(1), 
uno::UNO_QUERY);
+    OUString sOldText(xShape->getString());
+    CPPUNIT_ASSERT(sOldText.startsWith(u"在没有版本控制系统的时期"));
+
+    // Type something, getting into text editing mode (appending) automatically
+    insertStringToObject(1, u"Foo Bar", /*bUseEscape*/ false);
+
+    saveAndReload("impress8");
+
+    xDrawPagesSupplier.set(mxComponent, uno::UNO_QUERY);
+    xDrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(0), 
uno::UNO_QUERY);
+    xShape.set(xDrawPage->getByIndex(1), uno::UNO_QUERY);
+    OUString sExpectedText = sOldText + "Foo Bar";
+    CPPUNIT_ASSERT_EQUAL(sExpectedText, xShape->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696)
 {
     createSdImpressDoc();

Reply via email to