summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter/uiwriter.cxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-03-26 00:10:47 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-03-26 00:11:30 +0100
commit8bf22e7fe67b3321e2b2dcc8fb98882ef0eef4ca (patch)
treee49c09e3b3a76ef32cc4dfac8f80978773e42662 /sw/qa/extras/uiwriter/uiwriter.cxx
parent25b1d86643e5e60a3aa79d7ee3bd3e3828dc96b1 (diff)
related fdo#74981: add a unittest for kicks
Change-Id: I817948d053640b04dab8aaee85e914757b83cfa1
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter.cxx')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 5aef75bab9a0..3b7cfcf769b3 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();