From 947dcb4bcc9ca2cbe09e169d2d316fa055536448 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 5 Aug 2016 23:24:24 +0530 Subject: Add test for font in orcus interface Change-Id: Ibe2b5ef344a8f1ca27d3b59be9ac53e2c6f5b3b0 --- sc/qa/unit/data/xml/styles.xml | 7 ++---- sc/qa/unit/subsequent_filters-test.cxx | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml index 19eeff5169ff..118561f73038 100644 --- a/sc/qa/unit/data/xml/styles.xml +++ b/sc/qa/unit/data/xml/styles.xml @@ -15,11 +15,8 @@ - - - - - + + diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index d57cd6b9371a..24fdfa36b113 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "validat.hxx" #include "formulacell.hxx" @@ -2792,6 +2793,48 @@ void ScFiltersTest::testOrcusODSStyleInterface() CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute number format, but it shouldn't.", !pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem)); + /* Test for Style "Name6" + * Has Font name, posture, weight, color, height + */ + pStyleSheet = pStyleSheetPool->FindCaseIns("Name6", SfxStyleFamily::Para); + CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem)); + + const SvxFontItem* pFontItem= static_cast(pItem); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font name", pFontItem->GetStyleName() == "Liberation Sans"); + + CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Height, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_FONT_HEIGHT, &pItem)); + + const SvxFontHeightItem* pFontHeightItem= static_cast(pItem); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Height", pFontHeightItem->GetHeight() == 480); + + CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Posture, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem)); + + const SvxPostureItem* pFontPostureItem= static_cast(pItem); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Posture", pFontPostureItem->GetPosture() == ITALIC_NORMAL); + + CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Weight, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem)); + + const SvxWeightItem* pFontWeightItem= static_cast(pItem); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Weight", pFontWeightItem->GetWeight() == WEIGHT_BOLD); + + CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Color, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_FONT_COLOR, &pItem)); + + const SvxColorItem* pFontColorItem= static_cast(pItem); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Color", pFontColorItem->GetValue() == Color(128, 128, 128)); + + CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Underline, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_FONT_UNDERLINE, &pItem)); + + const SvxUnderlineItem* pUnderlineItem= static_cast(pItem); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Underline Style", pUnderlineItem->GetLineStyle() == LINESTYLE_SINGLE); + CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Underline Color", pUnderlineItem->GetColor() == Color(128, 128, 128)); + + } #endif -- cgit