[Libreoffice-commits] core.git: sd/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed May 27 03:31:08 PDT 2015


 sd/qa/unit/tiledrendering/data/dummy.odp     |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   36 ++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)

New commits:
commit a0576aec8381ca8ea36d60c925e871587702c268
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 27 11:59:00 2015 +0200

    CppunitTest_sd_tiledrendering: add part switching testcase
    
    Fails with the last hunk of commit
    67a37be9969d8b5a0bc8ae081bc1aba697ea6ba5 (sd: fix LOK search result
    highlight when result is not on the current slide, 2015-05-26) reverted.
    
    Change-Id: I5f8b57784ad1de1434113af7f94c9fde8672b4d5

diff --git a/sd/qa/unit/tiledrendering/data/dummy.odp b/sd/qa/unit/tiledrendering/data/dummy.odp
index e559de6..12cd679 100644
Binary files a/sd/qa/unit/tiledrendering/data/dummy.odp and b/sd/qa/unit/tiledrendering/data/dummy.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a55b026..9889015 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -37,6 +37,7 @@ static const char* DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
 class SdTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
 {
 public:
+    SdTiledRenderingTest();
     virtual void setUp() SAL_OVERRIDE;
     virtual void tearDown() SAL_OVERRIDE;
 
@@ -73,9 +74,17 @@ private:
 #if !defined(WNT) && !defined(MACOSX)
     Rectangle m_aInvalidation;
     std::vector<Rectangle> m_aSelection;
+    sal_Int32 m_nPart;
 #endif
 };
 
+SdTiledRenderingTest::SdTiledRenderingTest()
+#if !defined(WNT) && !defined(MACOSX)
+    : m_nPart(0)
+#endif
+{
+}
+
 void SdTiledRenderingTest::setUp()
 {
     test::BootstrapFixture::setUp();
@@ -158,6 +167,12 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
         }
     }
     break;
+    case LOK_CALLBACK_SET_PART:
+    {
+        OUString aPayload = OUString::createFromAscii(pPayload);
+        m_nPart = aPayload.toInt32();
+    }
+    break;
     }
 }
 
@@ -306,6 +321,16 @@ void SdTiledRenderingTest::testResetSelection()
     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()
 {
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
@@ -314,12 +339,7 @@ void SdTiledRenderingTest::testSearch()
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
     xShape->setString("Aaa bbb.");
 
-    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
-    {
-        {"SearchItem.SearchString", uno::makeAny(OUString("bbb"))},
-        {"SearchItem.Backward", uno::makeAny(false)}
-    }));
-    comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+    lcl_search("bbb");
 
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
     SdrView* pView = pViewShell->GetView();
@@ -329,6 +349,10 @@ void SdTiledRenderingTest::testSearch()
 
     // Did the selection callback fire?
     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


More information about the Libreoffice-commits mailing list