summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorGuillaume Smaha <guillaume.smaha@gmail.com>2015-11-25 10:18:51 +0100
committerMichael Stahl <mstahl@redhat.com>2016-01-14 14:57:07 +0100
commitadef474252f8b5ad97c1ee004783d8223c4bde11 (patch)
tree976d6c6eb18f3a5a6d32092228b6c3eff414ba80 /sw
parente99f22bbc499ab0566621ee0bb01e4a7747efe76 (diff)
RTF import, fix landscape flag & implement lndscpsxn
Reviewed-on: https://gerrit.libreoffice.org/20163 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com> Tested-by: Mark Hung <marklh9@gmail.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit cbc0c1b64bff517b27104c6335d45fb59a884931) Change-Id: Id2e8e9c1a9686fd674d712498acb7374a81077d7 Signed-off-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfimport/data/landscape.rtf13
-rw-r--r--sw/qa/extras/rtfimport/data/lndscpsxn.rtf17
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx73
3 files changed, 103 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/landscape.rtf b/sw/qa/extras/rtfimport/data/landscape.rtf
new file mode 100644
index 000000000000..9bbc3f711d4d
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/landscape.rtf
@@ -0,0 +1,13 @@
+{\rtf1 \ansi \landscape \paperw16837 \paperh11905
+{\sectd
+Test
+\par
+\sect}
+{\sectd
+TEST
+\par
+\sect}
+{\sectd
+Test
+\par}
+}
diff --git a/sw/qa/extras/rtfimport/data/lndscpsxn.rtf b/sw/qa/extras/rtfimport/data/lndscpsxn.rtf
new file mode 100644
index 000000000000..d904a548672e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/lndscpsxn.rtf
@@ -0,0 +1,17 @@
+{\rtf1 \ansi
+{\sectd \paperw16837 \paperh11905 \lndscpsxn
+Test
+\par
+\sect}
+{\sectd \paperw11905 \paperh16837
+TEST
+\par
+\sect}
+{\sectd \paperw16837 \paperh11905 \lndscpsxn
+Test
+\par
+\sect}
+{\sectd \paperw11905 \paperh16837
+TEST
+\par}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 36eaf0346475..f7e16fc2db28 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2373,6 +2373,79 @@ DECLARE_RTFIMPORT_TEST(testTdf59454, "tdf59454.rtf")
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
+DECLARE_RTFIMPORT_TEST(testLndscpsxn, "lndscpsxn.rtf")
+{
+ // Check landscape flag.
+ CPPUNIT_ASSERT_EQUAL(4, getPages());
+
+ uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");
+
+ // get a page cursor
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+ xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(
+ xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+
+ // check that the first page has landscape flag
+ xCursor->jumpToFirstPage();
+ OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ uno::Reference<style::XStyle> xStylePage(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+
+ // check that the second page has no landscape flag
+ xCursor->jumpToPage(2);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xStylePage.set(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_False, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+
+ // check that the third page has landscape flag
+ xCursor->jumpToPage(3);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xStylePage.set(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+
+ // check that the last page has no landscape flag
+ xCursor->jumpToLastPage();
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xStylePage.set(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_False, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+}
+
+DECLARE_RTFIMPORT_TEST(testLandscape, "landscape.rtf")
+{
+ // Check landscape flag.
+ CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+ // All pages should have flag orientiation
+ uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");
+
+ // get a page cursor
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+ xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(
+ xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+
+ // check that the first page has landscape flag
+ xCursor->jumpToFirstPage();
+ OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ uno::Reference<style::XStyle> xStylePage(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+
+ // check that the second page has landscape flag
+ xCursor->jumpToPage(2);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xStylePage.set(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+
+ // check that the last page has landscape flag
+ xCursor->jumpToLastPage();
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xStylePage.set(pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStylePage, "IsLandscape"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */