[Libreoffice-commits] core.git: svx/source sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Thu Nov 3 13:40:36 UTC 2016


 svx/source/items/pageitem.cxx      |    2 +-
 sw/qa/extras/uiwriter/uiwriter.cxx |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit a30f969432a451ade87b93e3077836a849b8f11b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 3 12:32:03 2016 +0100

    svx: add missing ~CONVERT_TWIPS mask in SvxPageItem::PutValue()
    
    With this, it's possible to use AttributePage.* keys in macros.
    
    Change-Id: I3f0b1ea8fb6274e7c18511c2e80774205206a2ba

diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx
index 7371ef1..53c01c1 100644
--- a/svx/source/items/pageitem.cxx
+++ b/svx/source/items/pageitem.cxx
@@ -180,7 +180,7 @@ bool SvxPageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
 
 bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 {
-    switch( nMemberId )
+    switch( nMemberId & ~CONVERT_TWIPS )
     {
         case MID_PAGE_NUMTYPE:
         {
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b37a6c4..e58093f 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -94,6 +94,7 @@
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
+#include <comphelper/propertyvalue.hxx>
 #include <config_features.h>
 
 static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
@@ -211,6 +212,7 @@ public:
     void testTdf78727();
     void testRedlineTimestamp();
     void testCursorWindows();
+    void testLandscape();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -320,6 +322,7 @@ public:
     CPPUNIT_TEST(testTdf78727);
     CPPUNIT_TEST(testRedlineTimestamp);
     CPPUNIT_TEST(testCursorWindows);
+    CPPUNIT_TEST(testLandscape);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4027,6 +4030,25 @@ void SwUiWriterTest::testCursorWindows()
     CPPUNIT_ASSERT_EQUAL(aText.getLength(), pShellCursor2->Start()->nContent.GetIndex());
 }
 
+void SwUiWriterTest::testLandscape()
+{
+    // Set page orientation to landscape.
+    SwDoc* pDoc = createDoc();
+    uno::Sequence<beans::PropertyValue> aPropertyValues =
+    {
+        comphelper::makePropertyValue("AttributePage.Landscape", true),
+    };
+    lcl_dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues);
+    Scheduler::ProcessEventsToIdle();
+
+    // Assert that the document model was modified.
+    SwDocShell* pDocShell = pDoc->GetDocShell();
+    SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+    size_t nPageDesc = pWrtShell->GetCurPageDesc();
+    // This failed, page was still portrait.
+    CPPUNIT_ASSERT(pWrtShell->GetPageDesc(nPageDesc).GetLandscape());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


More information about the Libreoffice-commits mailing list