summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2014-01-10 12:53:03 -0200
committerMarcos Souza <marcos.souza.org@gmail.com>2014-01-10 15:14:19 +0000
commitb1236dd7e86f40e54b7efb6082fad0967edb92d2 (patch)
tree4ac32e8508dc5bb70017424e249afc851d5942c2
parent1ae9feedf13f20a6c10e7bf2261d1f9257e60f87 (diff)
fdo#70807: Improve unit test using custom styles
As the bug talks about issues in custom styles, now they're tested too. Change-Id: I5f727718ec3591e29c44c49750a7c7a0841a8c61 Reviewed-on: https://gerrit.libreoffice.org/7373 Reviewed-by: Marcos Souza <marcos.souza.org@gmail.com> Tested-by: Marcos Souza <marcos.souza.org@gmail.com>
-rw-r--r--sw/qa/extras/uiwriter/data/fdo70807.odtbin22100 -> 22693 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx18
2 files changed, 13 insertions, 5 deletions
diff --git a/sw/qa/extras/uiwriter/data/fdo70807.odt b/sw/qa/extras/uiwriter/data/fdo70807.odt
index 6dad55ecf8a8..c22e24fa8ff9 100644
--- a/sw/qa/extras/uiwriter/data/fdo70807.odt
+++ b/sw/qa/extras/uiwriter/data/fdo70807.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 2e6a79ba8b02..8b2c1227124a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -126,13 +126,21 @@ void SwUiWriterTest::testFdo70807()
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
+ sal_Bool expectedUsedStyle = sal_False;
+ sal_Bool expectedUserDefined = sal_False;
- if (xName->getName() == "Right Page")
- used = sal_True;
+ OUString styleName(xName->getName());
- CPPUNIT_ASSERT_EQUAL(used, isUsed);
+ // just these styles are user defined styles
+ if (styleName == "pagestyle1" || styleName == "pagestyle2")
+ expectedUserDefined = sal_True;
+
+ // just these styles are used in the document
+ if (styleName == "Right Page" || styleName == "pagestyle1" || styleName == "pagestyle2")
+ expectedUsedStyle = sal_True;
+
+ CPPUNIT_ASSERT_EQUAL(expectedUserDefined, xStyle->isUserDefined());
+ CPPUNIT_ASSERT_EQUAL(expectedUsedStyle, xStyle->isInUse());
}
}