diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-08 12:39:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-09 07:25:29 +0000 |
commit | 9b95093950436caebd45a06008929427869844fa (patch) | |
tree | b5d08ffb144c208b5b6135258e0ca0a48b28acf7 /sc/qa | |
parent | 967d0089a16ad236a0fb9f5bba7fafd2327745a9 (diff) |
convert SvxCellHorJustify to scoped enum
Change-Id: I0dd88b5bf9e1aededfa2d94b6b2d3d26694fff33
Reviewed-on: https://gerrit.libreoffice.org/34968
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 26 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 11 |
2 files changed, 24 insertions, 13 deletions
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index b0a4847cebcb..3c4a42c3f919 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -71,6 +71,12 @@ std::ostream& operator<<(std::ostream& rStrm, const OpCode& rCode) return rStrm; } +std::ostream& operator<<(std::ostream& rStrm, const SvxCellHorJustify& rCode) +{ + rStrm << static_cast<int>(rCode); + return rStrm; +} + const FileFormat ScBootstrapFixture::aFileFormats[] = { { "ods" , "calc8", "", ODS_FORMAT_TYPE }, { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, @@ -227,15 +233,15 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) Color aColor = static_cast<const SvxBrushItem&>(pPattern->GetItem(ATTR_BACKGROUND)).GetColor(); CPPUNIT_ASSERT_EQUAL_MESSAGE("background color should be green", Color(COL_LIGHTGREEN), aColor); pPattern = pDoc->GetPattern(2,0,1); - SvxCellHorJustify eHorJustify = static_cast<SvxCellHorJustify>(static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned centre horizontally", SVX_HOR_JUSTIFY_CENTER, eHorJustify); + SvxCellHorJustify eHorJustify = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned centre horizontally", SvxCellHorJustify::Center, eHorJustify); //test alignment pPattern = pDoc->GetPattern(2,1,1); - eHorJustify = static_cast<SvxCellHorJustify>(static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned right horizontally", SVX_HOR_JUSTIFY_RIGHT, eHorJustify); + eHorJustify = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned right horizontally", SvxCellHorJustify::Right, eHorJustify); pPattern = pDoc->GetPattern(2,2,1); - eHorJustify = static_cast<SvxCellHorJustify>(static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned block horizontally", SVX_HOR_JUSTIFY_BLOCK, eHorJustify); + eHorJustify = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned block horizontally", SvxCellHorJustify::Block, eHorJustify); //test Sheet3 only for ods and xlsx if ( nFormat == FORMAT_ODS || nFormat == FORMAT_XLSX ) @@ -253,8 +259,8 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) CPPUNIT_ASSERT_EQUAL_MESSAGE("parent style for Sheet4.B2 is 'Excel Built-in Date'", sExpected, sResult); // check align of style SfxItemSet& rItemSet = pStyleSheet->GetItemSet(); - eHorJustify = static_cast<SvxCellHorJustify>(static_cast< const SvxHorJustifyItem& >(rItemSet.Get( ATTR_HOR_JUSTIFY ) ).GetValue() ); - CPPUNIT_ASSERT_EQUAL_MESSAGE("'Excel Built-in Date' style should be aligned centre horizontally", SVX_HOR_JUSTIFY_CENTER, eHorJustify); + eHorJustify = static_cast< const SvxHorJustifyItem& >(rItemSet.Get( ATTR_HOR_JUSTIFY ) ).GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("'Excel Built-in Date' style should be aligned centre horizontally", SvxCellHorJustify::Center, eHorJustify); // check date format ( should be just month e.g. 29 ) sResult =pDoc->GetString( 1,1,3 ); sExpected = "29"; @@ -262,8 +268,8 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) // check actual align applied to cell, should be the same as // the style - eHorJustify = static_cast<SvxCellHorJustify>(static_cast< const SvxHorJustifyItem& >(pPattern->GetItem( ATTR_HOR_JUSTIFY ) ).GetValue() ); - CPPUNIT_ASSERT_EQUAL_MESSAGE("cell with 'Excel Built-in Date' style should be aligned centre horizontally", SVX_HOR_JUSTIFY_CENTER, eHorJustify); + eHorJustify = static_cast< const SvxHorJustifyItem& >(pPattern->GetItem( ATTR_HOR_JUSTIFY ) ).GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("cell with 'Excel Built-in Date' style should be aligned centre horizontally", SvxCellHorJustify::Center, eHorJustify); } } diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index a7ce8ee33a8b..b2d262dfd0ac 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -360,6 +360,12 @@ private: uno::Reference<uno::XInterface> m_xCalcComponent; }; +std::ostream& operator<<(std::ostream& rStrm, const SvxCellHorJustify& rCode) +{ + rStrm << static_cast<int>(rCode); + return rStrm; +} + bool ScFiltersTest::load(const OUString &rFilter, const OUString &rURL, const OUString &rUserData, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) @@ -3029,7 +3035,7 @@ void ScFiltersTest::testOrcusODSStyleInterface() pStyleSheet->GetItemSet().HasItem(ATTR_HOR_JUSTIFY, &pItem)); const SvxHorJustifyItem* pHorJustify = static_cast<const SvxHorJustifyItem*>(pItem); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Style Name10 :Error with hor justify", SVX_HOR_JUSTIFY_RIGHT, pHorJustify->GetValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Style Name10 :Error with hor justify", SvxCellHorJustify::Right, pHorJustify->GetValue()); pStyleSheet = pStyleSheetPool->FindCaseIns("Name10", SfxStyleFamily::Para); CPPUNIT_ASSERT_MESSAGE("Style Name10 : Doesn't have Attribute ver justify, but it should have.", @@ -3706,8 +3712,7 @@ void ScFiltersTest::testColumnStyle2XLSX() { const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY); const SvxHorJustifyItem& rJustify = static_cast<const SvxHorJustifyItem&>(rItem); - sal_uInt16 nVal = rJustify.GetValue(); - CPPUNIT_ASSERT_EQUAL((sal_uInt16)SVX_HOR_JUSTIFY_CENTER, nVal); + CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Center, rJustify.GetValue()); } { |