Kaydet (Commit) a0576aec authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_sd_tiledrendering: add part switching testcase

Fails with the last hunk of commit
67a37be9 (sd: fix LOK search result
highlight when result is not on the current slide, 2015-05-26) reverted.

Change-Id: I5f8b57784ad1de1434113af7f94c9fde8672b4d5
üst c7ecbbbb
...@@ -37,6 +37,7 @@ static const char* DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/"; ...@@ -37,6 +37,7 @@ static const char* DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
class SdTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools class SdTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
{ {
public: public:
SdTiledRenderingTest();
virtual void setUp() SAL_OVERRIDE; virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE; virtual void tearDown() SAL_OVERRIDE;
...@@ -73,9 +74,17 @@ private: ...@@ -73,9 +74,17 @@ private:
#if !defined(WNT) && !defined(MACOSX) #if !defined(WNT) && !defined(MACOSX)
Rectangle m_aInvalidation; Rectangle m_aInvalidation;
std::vector<Rectangle> m_aSelection; std::vector<Rectangle> m_aSelection;
sal_Int32 m_nPart;
#endif #endif
}; };
SdTiledRenderingTest::SdTiledRenderingTest()
#if !defined(WNT) && !defined(MACOSX)
: m_nPart(0)
#endif
{
}
void SdTiledRenderingTest::setUp() void SdTiledRenderingTest::setUp()
{ {
test::BootstrapFixture::setUp(); test::BootstrapFixture::setUp();
...@@ -158,6 +167,12 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) ...@@ -158,6 +167,12 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
} }
} }
break; break;
case LOK_CALLBACK_SET_PART:
{
OUString aPayload = OUString::createFromAscii(pPayload);
m_nPart = aPayload.toInt32();
}
break;
} }
} }
...@@ -306,6 +321,16 @@ void SdTiledRenderingTest::testResetSelection() ...@@ -306,6 +321,16 @@ void SdTiledRenderingTest::testResetSelection()
CPPUNIT_ASSERT(!pView->GetTextEditObject()); CPPUNIT_ASSERT(!pView->GetTextEditObject());
} }
static void lcl_search(const OUString& rKey)
{
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
{
{"SearchItem.SearchString", uno::makeAny(rKey)},
{"SearchItem.Backward", uno::makeAny(false)}
}));
comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
}
void SdTiledRenderingTest::testSearch() void SdTiledRenderingTest::testSearch()
{ {
SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
...@@ -314,12 +339,7 @@ void SdTiledRenderingTest::testSearch() ...@@ -314,12 +339,7 @@ void SdTiledRenderingTest::testSearch()
uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
xShape->setString("Aaa bbb."); xShape->setString("Aaa bbb.");
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( lcl_search("bbb");
{
{"SearchItem.SearchString", uno::makeAny(OUString("bbb"))},
{"SearchItem.Backward", uno::makeAny(false)}
}));
comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
SdrView* pView = pViewShell->GetView(); SdrView* pView = pViewShell->GetView();
...@@ -329,6 +349,10 @@ void SdTiledRenderingTest::testSearch() ...@@ -329,6 +349,10 @@ void SdTiledRenderingTest::testSearch()
// Did the selection callback fire? // Did the selection callback fire?
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), m_aSelection.size()); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), m_aSelection.size());
// Search for something on the second slide, and make sure that the set-part callback fired.
lcl_search("bbb");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), m_nPart);
} }
#endif #endif
......
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