diff options
author | Eike Rathke <erack@redhat.com> | 2016-04-24 16:40:33 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-04-24 16:42:39 +0200 |
commit | 5291e4826a9512bd6d8d3b03199c49222a83e972 (patch) | |
tree | 9f1deb28314b8ce598ae8dfe11ee41ce1bf4cfbc /i18npool | |
parent | ffbe1b43bff59aae506446a5f408bba8ba9315c2 (diff) |
unit test for tdf#99468
Change-Id: I833ad2779d0eda6f5183b2dd062dffaa410a7937
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_textsearch.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 893bed5f1bb9..c4e98c9300e8 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -251,6 +251,29 @@ void TestTextSearch::testWildcardSearch() aRes = m_xSearch2->searchBackward( aText, aText.getLength(), 0); CPPUNIT_ASSERT(aRes.subRegExpressions == 1); CPPUNIT_ASSERT((aRes.startOffset[0] == 5) && (aRes.endOffset[0] == 0)); + + aText = "123123"; + aOptions.searchString = "*2?"; + m_xSearch2->setOptions2( aOptions ); + // match first "123", [0,3) + aRes = m_xSearch2->searchForward( aText, 0, aText.getLength()); + CPPUNIT_ASSERT(aRes.subRegExpressions == 1); + CPPUNIT_ASSERT((aRes.startOffset[0] == 0) && (aRes.endOffset[0] == 3)); + // match "123123", (6,0] Yes this looks odd, but it is as searching "?2*" forward. + aRes = m_xSearch2->searchBackward( aText, aText.getLength(), 0); + CPPUNIT_ASSERT(aRes.subRegExpressions == 1); + CPPUNIT_ASSERT((aRes.startOffset[0] == 6) && (aRes.endOffset[0] == 0)); + + aOptions.searchFlag |= util::SearchFlags::WILD_MATCH_SELECTION; + m_xSearch2->setOptions2( aOptions ); + // match "123123", [0,6) with greedy '*' + aRes = m_xSearch2->searchForward( aText, 0, aText.getLength()); + CPPUNIT_ASSERT(aRes.subRegExpressions == 1); + CPPUNIT_ASSERT((aRes.startOffset[0] == 0) && (aRes.endOffset[0] == 6)); + // match "123123", (6,0] + aRes = m_xSearch2->searchBackward( aText, aText.getLength(), 0); + CPPUNIT_ASSERT(aRes.subRegExpressions == 1); + CPPUNIT_ASSERT((aRes.startOffset[0] == 6) && (aRes.endOffset[0] == 0)); } void TestTextSearch::setUp() |