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

Marcos Paulo de Souza marcos.souza.org at gmail.com
Fri Jan 10 07:14:42 PST 2014


 sw/qa/extras/uiwriter/data/fdo70807.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx      |   18 +++++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit b1236dd7e86f40e54b7efb6082fad0967edb92d2
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Fri Jan 10 12:53:03 2014 -0200

    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 at gmail.com>
    Tested-by: Marcos Souza <marcos.souza.org at gmail.com>

diff --git a/sw/qa/extras/uiwriter/data/fdo70807.odt b/sw/qa/extras/uiwriter/data/fdo70807.odt
index 6dad55e..c22e24f 100644
Binary files a/sw/qa/extras/uiwriter/data/fdo70807.odt and b/sw/qa/extras/uiwriter/data/fdo70807.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 2e6a79b..8b2c122 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());
     }
 }
 


More information about the Libreoffice-commits mailing list