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

Miklos Vajna vmiklos at collabora.co.uk
Mon Aug 10 01:18:29 PDT 2015


 sw/qa/extras/uiwriter/data/tdf87922.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx      |   30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

New commits:
commit c438141318a79350ef26a37b59fd7328e46275b2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Aug 10 09:17:42 2015 +0200

    tdf#87922 testcase
    
    Change-Id: I71afd42a1825b44e885485051e56a1c1fb81b0c4
    Reviewed-on: https://gerrit.libreoffice.org/17620
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf87922.odt b/sw/qa/extras/uiwriter/data/tdf87922.odt
new file mode 100644
index 0000000..b0560f1
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf87922.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 233837c..cedc596 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -74,6 +74,8 @@
 #include "com/sun/star/text/TextMarkupType.hpp"
 #include <osl/file.hxx>
 #include <paratr.hxx>
+#include <drawfont.hxx>
+#include <txtfrm.hxx>
 #include <editeng/svxenum.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -151,6 +153,7 @@ public:
     void testTdf89954();
     void testTdf89720();
     void testTdf88986();
+    void testTdf87922();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -218,6 +221,7 @@ public:
     CPPUNIT_TEST(testTdf89954);
     CPPUNIT_TEST(testTdf89720);
     CPPUNIT_TEST(testTdf88986);
+    CPPUNIT_TEST(testTdf87922);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2223,6 +2227,32 @@ void SwUiWriterTest::testTdf88986()
     CPPUNIT_ASSERT(aSet.HasItem(SID_COLOR_TABLE));
 }
 
+void SwUiWriterTest::testTdf87922()
+{
+    // Create an SwDrawTextInfo.
+    SwDoc* pDoc = createDoc("tdf87922.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwScriptInfo* pScriptInfo = 0;
+    // Get access to the single paragraph in the document.
+    SwNodeIndex aNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1);
+    const OUString& rText = aNodeIndex.GetNode().GetTextNode()->GetText();
+    sal_Int32 nIndex = 0;
+    sal_Int32 nLength = rText.getLength();
+    SwDrawTextInfo aDrawTextInfo(pWrtShell, *pWrtShell->GetOut(), pScriptInfo, rText, nIndex, nLength);
+    // Root -> page -> body -> text.
+    SwTextFrm* pTextFrm = static_cast<SwTextFrm*>(pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower());
+    aDrawTextInfo.SetFrm(pTextFrm);
+
+    // If no color background color is found, assume white.
+    Color* pColor = sw::GetActiveRetoucheColor();
+    *pColor = Color(COL_WHITE);
+
+    // Make sure that automatic color on black background is white, not black.
+    vcl::Font aFont;
+    aDrawTextInfo.ApplyAutoColor(&aFont);
+    CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFont.GetColor().GetColor());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


More information about the Libreoffice-commits mailing list