summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/ooxmlexport/ooxmlexport.cxx')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cc4131e0fbc9..45e50b1ce44a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -121,6 +121,7 @@ public:
void testStyleInheritance();
void testSmartart();
void testFdo69636();
+ void testCharHighLight();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -239,6 +240,7 @@ void Test::run()
{"style-inheritance.docx", &Test::testStyleInheritance},
{"smartart.docx", &Test::testSmartart},
{"fdo69636.docx", &Test::testFdo69636},
+ {"char_highlight.docx", &Test::testCharHighLight},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -1492,6 +1494,53 @@ void Test::testFdo69636()
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:pict/v:rect/v:textbox", "style").match("mso-layout-flow-alt:bottom-to-top"));
}
+void Test::testCharHighLight()
+{
+ const uno::Reference< text::XTextRange > xPara = getParagraph(1);
+ // Both highlight and background
+ const sal_Int32 nBackColor(0x4F81BD);
+ for( int nRun = 1; nRun <= 16; ++nRun )
+ {
+ const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,nRun), uno::UNO_QUERY);
+ sal_Int32 nHighLightColor = 0;
+ switch( nRun )
+ {
+ case 1: nHighLightColor = 0x000000; break; //black
+ case 2: nHighLightColor = 0x0000ff; break; //blue
+ case 3: nHighLightColor = 0x00ffff; break; //cyan
+ case 4: nHighLightColor = 0x00ff00; break; //green
+ case 5: nHighLightColor = 0xff00ff; break; //magenta
+ case 6: nHighLightColor = 0xff0000; break; //red
+ case 7: nHighLightColor = 0xffff00; break; //yellow
+ case 8: nHighLightColor = 0xffffff; break; //white
+ case 9: nHighLightColor = 0x000080; break;//dark blue
+ case 10: nHighLightColor = 0x008080; break; //dark cyan
+ case 11: nHighLightColor = 0x008000; break; //dark green
+ case 12: nHighLightColor = 0x800080; break; //dark magenta
+ case 13: nHighLightColor = 0x800000; break; //dark red
+ case 14: nHighLightColor = 0x808000; break; //dark yellow
+ case 15: nHighLightColor = 0x808080; break; //dark gray
+ case 16: nHighLightColor = 0xC0C0C0; break; //light gray
+ }
+ CPPUNIT_ASSERT_EQUAL(nHighLightColor, getProperty<sal_Int32>(xRun,"CharHighLight"));
+ CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor"));
+ }
+
+ // Only highlight
+ {
+ const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,17), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0C0C0), getProperty<sal_Int32>(xRun,"CharHighLight"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharBackColor"));
+ }
+
+ // Only background
+ {
+ const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,18), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharHighLight"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0000ff), getProperty<sal_Int32>(xRun,"CharBackColor"));
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();