summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorVarun Dhall <varun.dhall@studentpartner.com>2016-02-23 20:38:59 +0530
committerMichael Stahl <mstahl@redhat.com>2016-02-25 13:51:15 +0100
commita3781a7ff856c9d808c836acda35706477229513 (patch)
tree305c48eaf055ca50a6e3d4c4417800d48f6a8b51 /sw/qa
parent90ddca81ae6fb4543d49193a23b5f6569ac5596a (diff)
Added test for tdf#73660 search for string with soft hyphen
Change-Id: Ia152f9cd97ead8e4289541ae6cd3e21a9635ffe0
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 304393e216cc..c3cccc931340 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -146,6 +146,7 @@ public:
void testUnoParagraph();
void testTdf60967();
void testSearchWithTransliterate();
+ void testTdf73660();
void testNewDocModifiedState();
void testTdf77342();
void testTdf74230();
@@ -234,6 +235,7 @@ public:
CPPUNIT_TEST(testUnoParagraph);
CPPUNIT_TEST(testTdf60967);
CPPUNIT_TEST(testSearchWithTransliterate);
+ CPPUNIT_TEST(testTdf73660);
CPPUNIT_TEST(testNewDocModifiedState);
CPPUNIT_TEST(testTdf77342);
CPPUNIT_TEST(testTdf74230);
@@ -1845,6 +1847,43 @@ void SwUiWriterTest::testSearchWithTransliterate()
CPPUNIT_ASSERT_EQUAL(1,(int)case2);
}
+void SwUiWriterTest::testTdf73660()
+{
+ SwDoc* pDoc = createDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ OUString aData1 = "First" + OUString(CHAR_SOFTHYPHEN) + "Word";
+ OUString aData2 = "Seco" + OUString(CHAR_SOFTHYPHEN) + "nd";
+ OUString aData3 = OUString(CHAR_SOFTHYPHEN) + "Third";
+ OUString aData4 = "Fourth" + OUString(CHAR_SOFTHYPHEN);
+ OUString aData5 = "Fifth";
+ pWrtShell->Insert("We are inserting some text in the document to check the search feature ");
+ pWrtShell->Insert(aData1 + " ");
+ pWrtShell->Insert(aData2 + " ");
+ pWrtShell->Insert(aData3 + " ");
+ pWrtShell->Insert(aData4 + " ");
+ pWrtShell->Insert(aData5 + " ");
+ pWrtShell->Insert("Now we have enough text let's test search for all the cases");
+ //searching for all 5 strings entered with soft-hyphen, search string contains no soft-hyphen
+ css::util::SearchOptions2 searchOpt;
+ searchOpt.algorithmType = css::util::SearchAlgorithms_REGEXP;
+ searchOpt.searchFlag = css::util::SearchFlags::NORM_WORD_ONLY;
+ //case 1
+ searchOpt.searchString = OUString("First");
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END));
+ //case 2
+ searchOpt.searchString = OUString("Second");
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END));
+ //case 3
+ searchOpt.searchString = OUString("Third");
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END));
+ //case 4
+ searchOpt.searchString = OUString("Fourth");
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END));
+ //case 5
+ searchOpt.searchString = OUString("Fifth");
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END));
+}
+
void SwUiWriterTest::testNewDocModifiedState()
{
//creating a new doc