diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-10 09:17:42 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-10 08:18:06 +0000 |
commit | c438141318a79350ef26a37b59fd7328e46275b2 (patch) | |
tree | dd5028649aae84fc49177ae7d616399b3ef10be9 | |
parent | 31937624e359803d2db8c12a805ec1a5c9d0fe30 (diff) |
tdf#87922 testcase
Change-Id: I71afd42a1825b44e885485051e56a1c1fb81b0c4
Reviewed-on: https://gerrit.libreoffice.org/17620
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf87922.odt | bin | 0 -> 8866 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 30 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf87922.odt b/sw/qa/extras/uiwriter/data/tdf87922.odt Binary files differnew file mode 100644 index 000000000000..b0560f180a28 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf87922.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 233837cc5829..cedc59654a0e 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(); |