LCOV - code coverage report
Current view: top level - sw/qa/extras/ww8export - ww8export.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 214 214 100.0 %
Date: 2014-11-03 Functions: 159 178 89.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  */
       8             : 
       9             : #include <swmodeltestbase.hxx>
      10             : 
      11             : #include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
      12             : #include <com/sun/star/frame/XStorable.hpp>
      13             : #include <com/sun/star/drawing/XControlShape.hpp>
      14             : #include <com/sun/star/beans/XPropertySet.hpp>
      15             : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
      16             : #include <com/sun/star/table/ShadowFormat.hpp>
      17             : #include <com/sun/star/table/TableBorder2.hpp>
      18             : #include <com/sun/star/text/GraphicCrop.hpp>
      19             : 
      20          68 : class Test : public SwModelTestBase
      21             : {
      22             : public:
      23          68 :     Test() : SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97") {}
      24             : 
      25          34 :     bool mustTestImportOf(const char* filename) const SAL_OVERRIDE
      26             :     {
      27             :         // If the testcase is stored in some other format, it's pointless to test.
      28          34 :         return OString(filename).endsWith(".doc");
      29             :     }
      30             : };
      31             : 
      32             : #define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
      33             : 
      34          28 : DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc")
      35             : {
      36             :     /*
      37             :      * The problem was that the transparent background of the drawing in the
      38             :      * header was exported as non-transparent.
      39             :      *
      40             :      * xray ThisComponent.DrawPage(0).BackColorTransparency
      41             :      */
      42             : 
      43           4 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
      44           4 :     sal_Int32 nValue = getProperty< sal_Int32 >(getShape(1), "BackColorTransparency");
      45           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue);
      46           4 : }
      47             : 
      48          26 : DECLARE_WW8EXPORT_TEST(testFdo45724, "fdo45724.odt")
      49             : {
      50             :     // The text and background color of the control shape was not correct.
      51           2 :     uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
      52           4 :     uno::Reference<form::validation::XValidatableFormComponent> xComponent(xControlShape->getControl(), uno::UNO_QUERY);
      53           2 :     CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<sal_uInt32>(xComponent, "BackgroundColor"));
      54           4 :     CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>());
      55           2 : }
      56             : 
      57          26 : DECLARE_WW8EXPORT_TEST(testFdo46020, "fdo46020.odt")
      58             : {
      59             :     // The footnote in that document wasn't exported, check that it is actually exported
      60           2 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
      61           4 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
      62           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount());
      63           2 : }
      64             : 
      65          28 : DECLARE_WW8EXPORT_TEST(testFirstHeaderFooter, "first-header-footer.doc")
      66             : {
      67             :     // Test import and export of a section's headerf/footerf properties.
      68             : 
      69             :     // The document has 6 pages. Note that we don't test if 4 or just 2 page
      70             :     // styles are created, the point is that layout should be correct.
      71           4 :     CPPUNIT_ASSERT_EQUAL(OUString("First page header"),  parseDump("/root/page[1]/header/txt/text()"));
      72           4 :     CPPUNIT_ASSERT_EQUAL(OUString("First page footer"),  parseDump("/root/page[1]/footer/txt/text()"));
      73           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Even page header"),   parseDump("/root/page[2]/header/txt/text()"));
      74           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Even page footer"),   parseDump("/root/page[2]/footer/txt/text()"));
      75           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Odd page header"),  parseDump("/root/page[3]/header/txt/text()"));
      76           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer"),  parseDump("/root/page[3]/footer/txt/text()"));
      77           4 :     CPPUNIT_ASSERT_EQUAL(OUString("First page header2"), parseDump("/root/page[4]/header/txt/text()"));
      78           4 :     CPPUNIT_ASSERT_EQUAL(OUString("First page footer 2"), parseDump("/root/page[4]/footer/txt/text()"));
      79           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Odd page header 2"), parseDump("/root/page[5]/header/txt/text()"));
      80           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer 2"), parseDump("/root/page[5]/footer/txt/text()"));
      81           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Even page header 2"),  parseDump("/root/page[6]/header/txt/text()"));
      82           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"),  parseDump("/root/page[6]/footer/txt/text()"));
      83           4 : }
      84             : 
      85          28 : DECLARE_WW8EXPORT_TEST(testZoom, "zoom.doc")
      86             : {
      87           4 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
      88           8 :     uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
      89           8 :     uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
      90           4 :     sal_Int16 nValue = 0;
      91           4 :     xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
      92           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
      93           4 : }
      94             : 
      95          28 : DECLARE_WW8EXPORT_TEST(test56513, "fdo56513.doc")
      96             : {
      97           4 :     CPPUNIT_ASSERT_EQUAL(OUString("This is the header of the first section"),  parseDump("/root/page[1]/header/txt/text()"));
      98           4 :     CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header of the second section"),   parseDump("/root/page[2]/header/txt/text()"));
      99           4 :     CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header of the second section"),  parseDump("/root/page[3]/header/txt/text()"));
     100           4 : }
     101             : 
     102          28 : DECLARE_WW8EXPORT_TEST(testNewPageStylesTable, "new-page-styles.doc")
     103             : {
     104           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Sigma Space Performance Goals and Results (Page 1)*"),  parseDump("/root/page[1]/header/txt/text()"));
     105           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Sigma Space Performance Assessment (Page 2)****"),   parseDump("/root/page[2]/header/txt/text()"));
     106           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Sigma Space Performance Goals: Next Year (Page 3)*******"),  parseDump("/root/page[3]/header/txt/text()"));
     107           4 : }
     108             : 
     109          26 : DECLARE_WW8EXPORT_TEST(testFdo42144, "fdo42144.odt")
     110             : {
     111             :     // Footer wasn't disabled -- instead empty footer was exported.
     112           2 :     uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     113           2 :     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(xStyle, "FooterIsOn")));
     114           2 : }
     115             : 
     116          26 : DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt")
     117             : {
     118           2 :     uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY);
     119             :     // WW8 has just one border attribute (sprmCBrc) for text border so all side has
     120             :     // the same border
     121             :     // Border
     122             :     {
     123           2 :         const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
     124           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF3333,0,318,0,0,318), aTopBorder);
     125           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
     126           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
     127           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
     128             :     }
     129             : 
     130             :     // Padding (dptSpace) it is constant 0
     131             :     {
     132           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharTopBorderDistance"));
     133           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharLeftBorderDistance"));
     134           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharBottomBorderDistance"));
     135           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharRightBorderDistance"));
     136             :     }
     137             : 
     138             :     // Shadow (fShadow)
     139             :     /* WW8 use just one bool value for shadow so the next conversions
     140             :        are made during an export-import round
     141             :        color: any -> black
     142             :        location: any -> bottom-right
     143             :        width: any -> border width */
     144             :     {
     145           2 :         const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
     146           2 :         CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
     147           2 :         CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
     148           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
     149           2 :     }
     150           2 : }
     151             : 
     152          28 : DECLARE_WW8EXPORT_TEST(testFdo77454, "fdo77454.doc")
     153             : {
     154             :     {
     155             :         // check negative crops round-trip
     156             :         text::GraphicCrop const crop =
     157           4 :             getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop");
     158           4 :         CPPUNIT_ASSERT_EQUAL(sal_Int32( -439), crop.Left);
     159           4 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(-7040), crop.Right);
     160           4 :         CPPUNIT_ASSERT_EQUAL(sal_Int32( -220), crop.Top);
     161           4 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(-7040), crop.Bottom);
     162             :     }
     163             : 
     164             :     {
     165             :         // check positive crops round-trip
     166             :         text::GraphicCrop const crop =
     167           4 :             getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
     168           4 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(  326), crop.Left);
     169           4 :         CPPUNIT_ASSERT_EQUAL(sal_Int32( 1208), crop.Right);
     170           4 :         CPPUNIT_ASSERT(abs(sal_Int32(1635) -  crop.Top) <= 2);
     171           4 :         CPPUNIT_ASSERT(abs(sal_Int32(  95) - crop.Bottom) <= 2);
     172             :     }
     173           4 : }
     174             : 
     175          28 : DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc")
     176             : {
     177             :     // See ooxmlexport's testFdo38244().
     178             :     // Test comment range feature.
     179           4 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     180           8 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     181           8 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     182           8 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     183           8 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     184           4 :     xRunEnum->nextElement();
     185           8 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
     186           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType"));
     187           4 :     xRunEnum->nextElement();
     188           4 :     xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
     189           4 :     CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
     190             : 
     191             :     // Test initials.
     192           8 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     193           8 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     194           8 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     195           4 :     xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
     196           4 :     CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
     197             : 
     198             :     // Test commented text range which spans over more text nodes
     199             :     // Comment starts in the second paragraph
     200           4 :     xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY);
     201           4 :     xRunEnum = xRunEnumAccess->createEnumeration();
     202           4 :     xRunEnum->nextElement();
     203           4 :     xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
     204           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType"));
     205             :     // Comment ends in the third paragraph
     206           4 :     xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY);
     207           4 :     xRunEnum = xRunEnumAccess->createEnumeration();
     208           4 :     xRunEnum->nextElement();
     209           4 :     xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
     210           8 :     CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
     211           4 : }
     212             : 
     213          28 : DECLARE_WW8EXPORT_TEST(testCommentsNested, "comments-nested.doc")
     214             : {
     215           4 :     uno::Reference<beans::XPropertySet> xOuter(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"), uno::UNO_QUERY);
     216           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content"));
     217             : 
     218           8 :     uno::Reference<beans::XPropertySet> xInner(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField"), uno::UNO_QUERY);
     219           8 :     CPPUNIT_ASSERT_EQUAL(OUString("Inner"), getProperty<OUString>(xInner, "Content"));
     220           4 : }
     221             : 
     222          26 : DECLARE_WW8EXPORT_TEST(testBorderColoursExport, "bordercolours.odt")
     223             : {
     224             :     // This is very close to testBorderColours in ww8import.cxx, but for export
     225             : 
     226             :     // The following 6 colours can only be represented with WW9 (Word 2000)
     227             :     // BRC (BoRder Control) structures.  We can tell that they have been
     228             :     // exported/imported using a WW8 (Word '97) BRC if they instead come
     229             :     // through as one of the 16 colours listed at this link:
     230             :     // http://msdn.microsoft.com/en-us/library/dd773060.aspx
     231           2 :     table::BorderLine2 expectedTop(0xFA670C, 0, 53, 0, 1, 53);
     232           2 :     table::BorderLine2 expectedLeft(0xD99594, 0, 79, 0, 0, 79);
     233           2 :     table::BorderLine2 expectedRight(0xB2A1C7, 53, 53, 53, 3, 159);
     234           2 :     table::BorderLine2 expectedBottom(0xB6DDE8, 0, 106, 0, 14, 106);
     235           2 :     table::BorderLine2 expectedDashedRed(0xFA670C, 0, 53, 0, 2, 53);
     236           2 :     table::BorderLine2 expectedDoubleGreen(0xC2D69B, 26, 106, 26, 4, 159);
     237             : 
     238             :     // Paragraph border
     239             :     uno::Reference<text::XBookmarksSupplier> bookmarksSupplier(mxComponent,
     240           2 :         uno::UNO_QUERY);
     241             :     uno::Reference<container::XNameAccess> bookmarks(
     242           4 :         bookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
     243             :     uno::Reference<text::XTextContent> bookmark(
     244           4 :         bookmarks->getByName("ParagraphBorder"), uno::UNO_QUERY);
     245           4 :     uno::Reference<text::XTextRange> anchor(bookmark->getAnchor());
     246           2 :     table::BorderLine2 border;
     247           2 :     border = getProperty<table::BorderLine2>(anchor, "TopBorder");
     248           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     249           2 :     border = getProperty<table::BorderLine2>(anchor, "LeftBorder");
     250           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
     251           2 :     border = getProperty<table::BorderLine2>(anchor, "RightBorder");
     252           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
     253           2 :     border = getProperty<table::BorderLine2>(anchor, "BottomBorder");
     254           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
     255             : 
     256             :     // Page border
     257           4 :     OUString pageStyleName = getProperty<OUString>(anchor, "PageStyleName");
     258             :     uno::Reference<style::XStyle> pageStyle(
     259           4 :         getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
     260           2 :     border = getProperty<table::BorderLine2>(pageStyle, "TopBorder");
     261           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     262           2 :     border = getProperty<table::BorderLine2>(pageStyle, "LeftBorder");
     263           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
     264           2 :     border = getProperty<table::BorderLine2>(pageStyle, "RightBorder");
     265           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
     266           2 :     border = getProperty<table::BorderLine2>(pageStyle, "BottomBorder");
     267           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
     268             : 
     269             :     // Character border
     270           2 :     bookmark.set(bookmarks->getByName("CharBorder"), uno::UNO_QUERY);
     271           2 :     anchor = bookmark->getAnchor();
     272           2 :     border = getProperty<table::BorderLine2>(anchor, "CharTopBorder");
     273           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     274           2 :     border = getProperty<table::BorderLine2>(anchor, "CharLeftBorder");
     275           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     276           2 :     border = getProperty<table::BorderLine2>(anchor, "CharRightBorder");
     277           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     278           2 :     border = getProperty<table::BorderLine2>(anchor, "CharBottomBorder");
     279           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     280             : 
     281             :     // Table border
     282             :     uno::Reference<text::XTextTablesSupplier> tablesSupplier(mxComponent,
     283           4 :         uno::UNO_QUERY);
     284             :     uno::Reference<container::XNameAccess> tables(
     285           4 :         tablesSupplier->getTextTables(), uno::UNO_QUERY);
     286             :     uno::Reference<text::XTextTable> table(
     287           4 :         tables->getByName("Table1"), uno::UNO_QUERY);
     288             :     table::TableBorder2 tableBorder = getProperty<table::TableBorder2>(
     289           2 :         table, "TableBorder2");
     290           2 :     CPPUNIT_ASSERT_EQUAL(expectedTop.Color, tableBorder.TopLine.Color);
     291           2 :     CPPUNIT_ASSERT_EQUAL(expectedLeft.Color, tableBorder.LeftLine.Color);
     292           2 :     CPPUNIT_ASSERT_EQUAL(expectedRight.Color, tableBorder.RightLine.Color);
     293             : #if 0
     294             :     // #if'd out because the "fine dashed" border line style for table borders
     295             :     // does not seem to save or load correctly in odt format at present
     296             :     CPPUNIT_ASSERT_EQUAL(expectedBottom.Color, tableBorder.BottomLine.Color);
     297             : #endif
     298             : 
     299             :     // Table cells
     300             :     uno::Reference<table::XCell> cell(
     301           4 :         table->getCellByName("A2"), uno::UNO_QUERY);
     302           2 :     border = getProperty<table::BorderLine2>(cell, "TopBorder");
     303           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     304           2 :     border = getProperty<table::BorderLine2>(cell, "LeftBorder");
     305           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
     306           2 :     border = getProperty<table::BorderLine2>(cell, "BottomBorder");
     307             : #if 0
     308             :     // #if'd out because the "fine dashed" border line style for table borders
     309             :     // does not seem to save or load correctly in odt format at present
     310             :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
     311             : #endif
     312             : 
     313           2 :     cell.set(table->getCellByName("B2"), uno::UNO_QUERY);
     314           2 :     border = getProperty<table::BorderLine2>(cell, "TopBorder");
     315           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
     316           2 :     border = getProperty<table::BorderLine2>(cell, "LeftBorder");
     317           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
     318           2 :     border = getProperty<table::BorderLine2>(cell, "BottomBorder");
     319           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
     320             : 
     321           2 :     cell.set(table->getCellByName("C2"), uno::UNO_QUERY);
     322           2 :     border = getProperty<table::BorderLine2>(cell, "TopBorder");
     323           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
     324           2 :     border = getProperty<table::BorderLine2>(cell, "LeftBorder");
     325           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedDashedRed, border);
     326           2 :     border = getProperty<table::BorderLine2>(cell, "RightBorder");
     327           2 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
     328           2 :     border = getProperty<table::BorderLine2>(cell, "BottomBorder");
     329           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border);
     330             : 
     331             :     // Picture border
     332             :     // (#if'd out as they are not yet exported with correct colours)
     333             : #if 0
     334             :     bookmark.set(bookmarks->getByName("PictureBorder"),uno::UNO_QUERY);
     335             :     anchor = bookmark->getAnchor();
     336             :     border = getProperty<table::BorderLine2>(anchor, "TopBorder");
     337             :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
     338             :     border = getProperty<table::BorderLine2>(anchor, "LeftBorder");
     339             :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
     340             :     border = getProperty<table::BorderLine2>(anchor, "RightBorder");
     341             :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
     342             :     border = getProperty<table::BorderLine2>(anchor, "BottomBorder");
     343             :     CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
     344             : #endif
     345           2 : }
     346             : 
     347          26 : DECLARE_WW8EXPORT_TEST(testRedlineExport1, "redline-export-1.odt")
     348             : {
     349           2 :     uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
     350           4 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
     351           4 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     352             :     //there must be no redline information on the first line before and after reloading
     353           6 :     while (xRunEnum->hasMoreElements())
     354             :     {
     355           2 :         uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
     356           2 :         CPPUNIT_ASSERT_EQUAL(false, hasProperty(xRun, "RedlineType"));
     357           4 :     }
     358           2 : }
     359             : 
     360          26 : DECLARE_WW8EXPORT_TEST(testRedlineExport2, "redline-export-2.odt")
     361             : {
     362             :     //there must be redline information on the first portion of the third paragraph before and after reloading
     363           2 :     CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(3), 1), "RedlineType"));
     364           2 : }
     365             : 
     366          26 : DECLARE_WW8EXPORT_TEST(testRedlineExport3, "redline-export-3.odt")
     367             : {
     368             :     //there must be redline information just on the para-break boundary between para one and two
     369           2 :     CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(1), 1), "RedlineType"));
     370           2 :     CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(1), 2), "RedlineType"));
     371           2 :     CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(2), 1), "RedlineType"));
     372           2 :     CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(2), 2), "RedlineType"));
     373           2 : }
     374             : 
     375          26 : DECLARE_WW8EXPORT_TEST(testCellBgColor, "cell-bg-color.odt")
     376             : {
     377           2 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     378           4 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
     379           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     380           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"));
     381           2 : }
     382             : 
     383           8 : CPPUNIT_PLUGIN_IMPLEMENT();
     384             : 
     385             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10