dev/null |binary sw/qa/extras/odfimport/data/dateFormFormats.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 44 ++++++++++++++++++++++++ sw/qa/extras/uiwriter/data3/tdf125261.odt |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 19 ++++++++++ sw/qa/uitest/writer_tests6/tdf125261.py | 35 ------------------- 6 files changed, 63 insertions(+), 35 deletions(-)
New commits: commit 1391b1b3eb3d28c7a606a3f0357eef6ca71267e7 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Mar 5 18:29:20 2020 +0100 Commit: Xisco Faulí <[email protected]> CommitDate: Fri Mar 6 11:46:20 2020 +0100 tdf#125261: move UItest to CppunitTest Change-Id: I3623d9424c95983e005c146728518bafcd6d2dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90053 Tested-by: Jenkins Reviewed-by: Xisco Faulí <[email protected]> diff --git a/sw/qa/extras/uiwriter/data3/tdf125261.odt b/sw/qa/extras/uiwriter/data3/tdf125261.odt new file mode 100644 index 000000000000..f89e1b21f518 Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf125261.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 997e4d25317b..4d89873629d7 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -91,6 +91,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128739) CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf125261) +{ + load(DATA_DIRECTORY, "tdf125261.odt"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(OUString("https://www.example.com/"), + getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); + //apply autocorrect StartAutoCorrect + dispatchCommand(mxComponent, ".uno:AutoFormatApply", {}); + CPPUNIT_ASSERT_EQUAL(OUString("https://www.example.com/"), + getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); + // without the fix, it hangs + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(OUString("https://www.example.com/"), + getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126340) { load(DATA_DIRECTORY, "tdf126340.odt"); diff --git a/sw/qa/uitest/writer_tests/data/tdf125261.odt b/sw/qa/uitest/writer_tests/data/tdf125261.odt deleted file mode 100644 index 5fd8152448da..000000000000 Binary files a/sw/qa/uitest/writer_tests/data/tdf125261.odt and /dev/null differ diff --git a/sw/qa/uitest/writer_tests6/tdf125261.py b/sw/qa/uitest/writer_tests6/tdf125261.py deleted file mode 100644 index 72a0be3f2910..000000000000 --- a/sw/qa/uitest/writer_tests6/tdf125261.py +++ /dev/null @@ -1,35 +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 uitest.uihelper.common import get_state_as_dict -from uitest.uihelper.common import select_pos -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, type_text -from uitest.debug import sleep -import org.libreoffice.unotest -import pathlib - -def get_url_for_data_file(file_name): - return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() - -#Bug 125261 - Applying autocorrect to text with URLs causes Writer to hang - -class tdf125261(UITestCase): - def test_tdf125261_crash_autocorrect_text_with_URL(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf125261.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #apply autocorrect StartAutoCorrect - self.xUITest.executeCommand(".uno:AutoFormatApply") - - self.xUITest.executeCommand(".uno:Undo") - - self.assertEqual(document.Text.String[0:4], "This") - self.ui_test.close_doc() -# vim: set shiftwidth=4 softtabstop=4 expandtab: commit 375d314cb48e0b9bab6c520bf2ceaf6de85db815 Author: Xisco Fauli <[email protected]> AuthorDate: Wed Mar 4 17:13:50 2020 +0100 Commit: Xisco Faulí <[email protected]> CommitDate: Fri Mar 6 11:46:09 2020 +0100 sw: add test for date formats Change-Id: Idf6920278c82a1bdddeb4e1b43c444010fba1aa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89985 Tested-by: Jenkins Reviewed-by: Xisco Faulí <[email protected]> diff --git a/sw/qa/extras/odfimport/data/dateFormFormats.odt b/sw/qa/extras/odfimport/data/dateFormFormats.odt new file mode 100644 index 000000000000..ef99e70f41dc Binary files /dev/null and b/sw/qa/extras/odfimport/data/dateFormFormats.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 8eff1cf92e1f..55a477ba0aa5 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -269,6 +269,7 @@ DECLARE_ODFIMPORT_TEST(testTimeFormFormats, "timeFormFormats.odt") { //FIXME: make it an ODFEXPORT_TEST. Validator fails with //attribute "form:current-value" has a bad value: "PT12H12M" does not satisfy the "time" type + //See tdf#131127 uno::Reference<frame::XModel> const xModel(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xModel.is()); @@ -305,6 +306,49 @@ DECLARE_ODFIMPORT_TEST(testTimeFormFormats, "timeFormFormats.odt") } } +DECLARE_ODFIMPORT_TEST(testDateFormFormats, "dateFormFormats.odt") +{ + //FIXME: make it an ODFEXPORT_TEST. Validator fails with + //unexpected attribute "form:input-required" + //See tdf#131148 + + uno::Reference<frame::XModel> const xModel(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT(xModel.is()); + uno::Reference<drawing::XDrawPageSupplier> const xDPS(xModel, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> const xDP = xDPS->getDrawPage(); + CPPUNIT_ASSERT(xDP.is()); + uno::Reference<form::XFormsSupplier> const xFS(xDP, uno::UNO_QUERY); + CPPUNIT_ASSERT(xFS.is()); + uno::Reference<container::XIndexContainer> const xForms(xFS->getForms(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xForms.is()); + uno::Reference<form::XForm> xForm(xForms->getByIndex(0), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xForm.is()); + uno::Reference<container::XNameContainer> xFormNC(xForm, uno::UNO_QUERY); + + uno::Any aAny; + uno::Reference<awt::XControlModel> xControlModel; + uno::Reference<view::XControlAccess> xController; + uno::Reference<awt::XControl> xControl; + uno::Reference<awt::XWindowPeer> xWindowPeer; + uno::Reference<awt::XTextComponent> xTextComponent; + OUString aName = "Date Field "; + + static const char* const aExpectedResults[] = { "03/04/20", "03/04/20", "03/04/2020", + "Wednesday, March 4, 2020", "04/03/20", "03/04/20", "20/03/04", "04/03/2020", "03/04/2020", + "2020/03/04", "20-03-04", "2020-03-04"}; + + for (size_t i = 1; i <= 12; ++i) + { + aAny = xFormNC->getByName(aName + OUString::number(i)); + xControlModel.set(aAny, uno::UNO_QUERY); + xController.set(xModel->getCurrentController(), uno::UNO_QUERY_THROW); + xControl = xController->getControl(xControlModel); + xWindowPeer = xControl->getPeer(); + xTextComponent.set(xWindowPeer, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8(aExpectedResults[i - 1]), xTextComponent->getText()); + } +} + DECLARE_ODFIMPORT_TEST(testTdf64038, "space.odt") { // no space _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
