diff options
Diffstat (limited to 'vcl/qa/cppunit/VectorGraphicSearchTest.cxx')
-rw-r--r-- | vcl/qa/cppunit/VectorGraphicSearchTest.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx index 5f65b4ba7e3d..8dbdcac0e2e1 100644 --- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx +++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx @@ -27,10 +27,12 @@ class VectorGraphicSearchTest : public test::BootstrapFixtureBase void test(); void testNextPrevious(); + void testSearchStringChange(); CPPUNIT_TEST_SUITE(VectorGraphicSearchTest); CPPUNIT_TEST(test); CPPUNIT_TEST(testNextPrevious); + CPPUNIT_TEST(testSearchStringChange); CPPUNIT_TEST_SUITE_END(); }; @@ -160,6 +162,37 @@ void VectorGraphicSearchTest::testNextPrevious() } } +void VectorGraphicSearchTest::testSearchStringChange() +{ + OUString aURL = getFullUrl("Pangram.pdf"); + SvFileStream aStream(aURL, StreamMode::READ); + GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); + Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); + aGraphic.makeAvailable(); + + VectorGraphicSearch aSearch(aGraphic); + + // Set search to "lazy" + CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy")); + + CPPUNIT_ASSERT_EQUAL(true, aSearch.next()); + CPPUNIT_ASSERT_EQUAL(34, aSearch.index()); + + CPPUNIT_ASSERT_EQUAL(true, aSearch.next()); + CPPUNIT_ASSERT_EQUAL(817, aSearch.index()); + + // Change search to "fox" + CPPUNIT_ASSERT_EQUAL(true, aSearch.search("fox")); + + CPPUNIT_ASSERT_EQUAL(true, aSearch.next()); + CPPUNIT_ASSERT_EQUAL(822, aSearch.index()); + + // Change search to "Quick" + CPPUNIT_ASSERT_EQUAL(true, aSearch.search("Quick")); + CPPUNIT_ASSERT_EQUAL(true, aSearch.previous()); + CPPUNIT_ASSERT_EQUAL(784, aSearch.index()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |