Kaydet (Commit) 8bf22e7f authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

related fdo#74981: add a unittest for kicks

Change-Id: I817948d053640b04dab8aaee85e914757b83cfa1
üst 25b1d866
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment