[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 14 09:20:58 UTC 2021
sw/qa/extras/uiwriter/uiwriter3.cxx | 48 ++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
New commits:
commit ce324c96132066a614d302ba07723026e5c6b83e
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Jan 13 13:01:20 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jan 14 10:20:14 2021 +0100
tdf#139566: sw_uiwriter3: Add unittest
Change-Id: I60fb8411ec3c69159998120e40d7db5291f87674
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109224
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 37e55f7e3318..69b0bd394514 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1538,6 +1538,54 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134626)
}
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139566)
+{
+ mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
+ { { "Rows", uno::makeAny(sal_Int32(1)) }, { "Columns", uno::makeAny(sal_Int32(1)) } }));
+
+ dispatchCommand(mxComponent, ".uno:InsertTable", aArgs);
+ Scheduler::ProcessEventsToIdle();
+
+ SwWrtShell* pWrtSh = pTextDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtSh);
+
+ // Move the cursor outside the table
+ pWrtSh->Down(/*bSelect=*/false);
+
+ pWrtSh->Insert("Test");
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Test"), getParagraph(2)->getString());
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ Scheduler::ProcessEventsToIdle();
+
+ uno::Reference<frame::XFrames> xFrames = mxDesktop->getFrames();
+ sal_Int32 nFrames = xFrames->getCount();
+
+ // Create a second window so the first window looses focus
+ dispatchCommand(mxComponent, ".uno:NewWindow", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(nFrames + 1, xFrames->getCount());
+
+ dispatchCommand(mxComponent, ".uno:CloseWin", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(nFrames, xFrames->getCount());
+
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xSelections(xModel->getCurrentSelection(),
+ uno::UNO_QUERY);
+
+ // Without the fix in place, this test would have failed here
+ CPPUNIT_ASSERT(xSelections.is());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf96067)
{
mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
More information about the Libreoffice-commits
mailing list