sw/qa/extras/uiwriter/uiwriter.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
New commits: commit 8bf22e7fe67b3321e2b2dcc8fb98882ef0eef4ca Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Mar 26 00:10:47 2014 +0100 related fdo#74981: add a unittest for kicks Change-Id: I817948d053640b04dab8aaee85e914757b83cfa1 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 5aef75b..3b7cfcf 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -11,6 +11,7 @@ #include <wrtsh.hxx> #include <crsskip.hxx> #include <shellio.hxx> +#include <expfld.hxx> #include "UndoManager.hxx" @@ -30,6 +31,7 @@ public: void testExportRTF(); void testFdo75110(); void testFdo75898(); + void testFdo74981(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -40,6 +42,7 @@ public: CPPUNIT_TEST(testExportRTF); CPPUNIT_TEST(testFdo75110); CPPUNIT_TEST(testFdo75898); + CPPUNIT_TEST(testFdo74981); CPPUNIT_TEST_SUITE_END(); private: @@ -232,6 +235,32 @@ void SwUiWriterTest::testExportRTF() CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aData.indexOf("ccc")); } +void SwUiWriterTest::testFdo74981() +{ + // create a document with an input field + SwDoc* pDoc = createDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwInputField aField((SwInputFieldType*)pWrtShell->GetFldType(0, RES_INPUTFLD), OUString("foo"), OUString("bar"), 0, 0); + pWrtShell->Insert(aField); + + // expect hints + SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); + SwTxtNode* pTxtNode = aIdx.GetNode().GetTxtNode(); + CPPUNIT_ASSERT(pTxtNode->HasHints()); + + // go to the begin of the paragraph and split this node + pWrtShell->Left(CRSR_SKIP_CHARS, false, 100, false); + pWrtShell->SplitNode(); + + // expect only the second paragraph to have hints + aIdx = SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1); + pTxtNode = aIdx.GetNode().GetTxtNode(); + CPPUNIT_ASSERT(pTxtNode->HasHints()); + aIdx--; + pTxtNode = aIdx.GetNode().GetTxtNode(); + CPPUNIT_ASSERT(!pTxtNode->HasHints()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits