diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2014-01-09 22:33:09 -0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-10 08:47:52 +0000 |
commit | 16ae82c772cd818316a19ce303d349657f6cb863 (patch) | |
tree | 3d19e45dfa85a466cc4f64d700160a34881f54d8 /sw | |
parent | e6323214830895d1c76ec44ee53990bf577fbda2 (diff) |
fdo#70807: UT to verify used styles in document
Change-Id: Ief2eef638bc3f9e44358addf0d1c655a790834a2
Reviewed-on: https://gerrit.libreoffice.org/7351
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/fdo70807.odt | bin | 0 -> 22100 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 23 |
2 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/fdo70807.odt b/sw/qa/extras/uiwriter/data/fdo70807.odt Binary files differnew file mode 100644 index 000000000000..6dad55ecf8a8 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/fdo70807.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 12c76b8a6af7..2e6a79ba8b02 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -23,11 +23,13 @@ public: //EDITING: undo search&replace corrupt text when searching backward void testReplaceBackward(); void testFdo69893(); + void testFdo70807(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); CPPUNIT_TEST(testReplaceBackward); CPPUNIT_TEST(testFdo69893); + CPPUNIT_TEST(testFdo70807); CPPUNIT_TEST_SUITE_END(); private: @@ -113,6 +115,27 @@ void SwUiWriterTest::testFdo69893() CPPUNIT_ASSERT_EQUAL(OUString("Para after table."), rEnd.GetTxt()); } +void SwUiWriterTest::testFdo70807() +{ + load(DATA_DIRECTORY, "fdo70807.odt"); + + uno::Reference<container::XIndexAccess> stylesIter(getStyles("PageStyles"), uno::UNO_QUERY); + + for (sal_Int32 i = 0; i < stylesIter->getCount(); ++i) + { + uno::Reference<style::XStyle> xStyle(stylesIter->getByIndex(i), uno::UNO_QUERY); + uno::Reference<container::XNamed> xName(xStyle, uno::UNO_QUERY); + + sal_Bool isUsed = xStyle->isInUse(); + sal_Bool used = sal_False; // just "Right Page" is used + + if (xName->getName() == "Right Page") + used = sal_True; + + CPPUNIT_ASSERT_EQUAL(used, isUsed); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |