sd/qa/uitest/impress_tests/tdf129346.py | 31 -------------------------- sd/qa/unit/uiimpress.cxx | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 31 deletions(-)
New commits: commit 6922748ceab390f69d0e5fbb2335c0adda4c89c6 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Apr 1 18:15:45 2020 +0200 Commit: Xisco FaulĂ <xiscofa...@libreoffice.org> CommitDate: Wed Apr 1 19:14:10 2020 +0200 tdf#129346: move UItest to CppunitTest Change-Id: I8bb10f5f1814c4c8fc1330017a0c1a01d4558cdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91526 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ <xiscofa...@libreoffice.org> diff --git a/sd/qa/uitest/impress_tests/tdf129346.py b/sd/qa/uitest/impress_tests/tdf129346.py deleted file mode 100644 index 7c22256955f3..000000000000 --- a/sd/qa/uitest/impress_tests/tdf129346.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues - -class tdf129346(UITestCase): - - def test_run(self): - self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - self.xUITest.executeCommand(".uno:DiaMode") - xDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) - self.xUITest.executeCommand(".uno:InsertPage") - - self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) - self.xUITest.executeCommand(".uno:Undo") - - #Without the accompanying fix in place, getCurrentPage() is None - self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index eca5d6c5fb2f..0950215e00b3 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -10,6 +10,7 @@ #include <test/bootstrapfixture.hxx> #include <unotest/macros_test.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/uno/Reference.hxx> @@ -22,8 +23,10 @@ #include <svx/svdoashp.hxx> #include <svl/stritem.hxx> #include <undo/undomanager.hxx> +#include <vcl/scheduler.hxx> #include <DrawDocShell.hxx> +#include <DrawController.hxx> #include <ViewShell.hxx> #include <app.hrc> #include <drawdoc.hxx> @@ -41,6 +44,8 @@ protected: public: virtual void setUp() override; virtual void tearDown() override; + + void checkCurrentPageNumber(sal_uInt16 nNum); }; void SdUiImpressTest::setUp() @@ -58,6 +63,18 @@ void SdUiImpressTest::tearDown() test::BootstrapFixture::tearDown(); } +void SdUiImpressTest::checkCurrentPageNumber(sal_uInt16 nNum) +{ + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawView> xDrawView(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xPage(xDrawView->getCurrentPage(), uno::UNO_SET_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(xPage, uno::UNO_QUERY); + + sal_uInt16 nPageNumber; + xPropertySet->getPropertyValue("Number") >>= nPageNumber; + CPPUNIT_ASSERT_EQUAL(nNum, nPageNumber); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf111522) { // Load the document and create two new windows. @@ -188,6 +205,27 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf128651) const sal_Int32 nRedoWidth(pCustomShape->GetSnapRect().GetWidth()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Redo changes width", nUndoWidth, nRedoWidth); } + +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf129346) +{ + mxComponent = loadFromDesktop("private:factory/simpress", + "com.sun.star.presentation.PresentationDocument"); + + CPPUNIT_ASSERT(mxComponent.is()); + + dispatchCommand(mxComponent, ".uno:DiaMode", {}); + Scheduler::ProcessEventsToIdle(); + checkCurrentPageNumber(1); + + dispatchCommand(mxComponent, ".uno:InsertPage", {}); + Scheduler::ProcessEventsToIdle(); + checkCurrentPageNumber(2); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + checkCurrentPageNumber(1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits