Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include <swmodeltestbase.hxx>
11 :
12 : #include <com/sun/star/awt/XBitmap.hpp>
13 : #include <com/sun/star/graphic/XGraphic.hpp>
14 : #include <com/sun/star/frame/XStorable.hpp>
15 : #include <com/sun/star/drawing/FillStyle.hpp>
16 : #include <com/sun/star/drawing/LineJoint.hpp>
17 : #include <com/sun/star/drawing/LineStyle.hpp>
18 : #include <com/sun/star/drawing/XControlShape.hpp>
19 : #include <com/sun/star/awt/Gradient.hpp>
20 : #include <com/sun/star/style/TabStop.hpp>
21 : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
22 : #include <com/sun/star/text/RelOrientation.hpp>
23 : #include <com/sun/star/text/XTextFrame.hpp>
24 : #include <com/sun/star/text/XTextTable.hpp>
25 : #include <com/sun/star/text/XTextFramesSupplier.hpp>
26 : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
27 : #include <com/sun/star/text/XTextSection.hpp>
28 : #include <com/sun/star/style/CaseMap.hpp>
29 : #include <com/sun/star/style/ParagraphAdjust.hpp>
30 : #include <com/sun/star/style/LineSpacing.hpp>
31 : #include <com/sun/star/style/LineSpacingMode.hpp>
32 : #include <com/sun/star/view/XSelectionSupplier.hpp>
33 : #include <com/sun/star/table/BorderLine2.hpp>
34 : #include <com/sun/star/table/ShadowFormat.hpp>
35 : #include <com/sun/star/text/GraphicCrop.hpp>
36 : #include <com/sun/star/text/XPageCursor.hpp>
37 : #include <com/sun/star/awt/FontWeight.hpp>
38 : #include <com/sun/star/awt/FontUnderline.hpp>
39 : #include <com/sun/star/awt/FontSlant.hpp>
40 : #include <com/sun/star/text/WritingMode2.hpp>
41 : #include <com/sun/star/text/WrapTextMode.hpp>
42 : #include <com/sun/star/xml/dom/XDocument.hpp>
43 : #include <com/sun/star/style/BreakType.hpp>
44 : #include <unotools/tempfile.hxx>
45 : #include <comphelper/sequenceashashmap.hxx>
46 : #include <com/sun/star/text/XDocumentIndex.hpp>
47 : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
48 : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
49 : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
50 : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
51 : #include <com/sun/star/drawing/Hatch.hpp>
52 :
53 : #include <string>
54 :
55 82 : class Test : public SwModelTestBase
56 : {
57 : public:
58 82 : Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
59 :
60 : protected:
61 : /**
62 : * Blacklist handling
63 : */
64 41 : bool mustTestImportOf(const char* filename) const SAL_OVERRIDE {
65 : const char* aBlacklist[] = {
66 : "math-escape.docx",
67 : "math-mso2k7.docx"
68 41 : };
69 41 : std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
70 :
71 : // If the testcase is stored in some other format, it's pointless to test.
72 41 : return (OString(filename).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end());
73 : }
74 : };
75 :
76 : #if !defined(WNT)
77 :
78 17 : DECLARE_OOXMLEXPORT_TEST(testFdo68418, "fdo68418.docx")
79 : {
80 : // The problem was that in 'MSWordExportBase::SectionProperties' function in 'wrt8sty.cxx'
81 : // it checked if it 'IsPlausableSingleWordSection'.
82 : // The 'IsPlausableSingleWordSection' compared different aspects of 2 'SwFrameFormat' objects.
83 : // One of the checks was 'do both formats have the same distance from the top and bottom ?'
84 : // This check is correct if both have headers or both don't have headers.
85 : // However - if one has a header, and the other one has an empty header (no header) - it is not correct to compare
86 : // between them (same goes for 'footer').
87 2 : uno::Reference<text::XText> xFooterText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "FooterText");
88 4 : uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText );
89 :
90 : // First page footer is empty, second page footer is 'aaaa'
91 4 : CPPUNIT_ASSERT_EQUAL(OUString("aaaa"), xFooterParagraph->getString()); // I get an error that it expects ''
92 2 : }
93 :
94 17 : DECLARE_OOXMLEXPORT_TEST(testA4AndBorders, "a4andborders.docx")
95 : {
96 : /*
97 : * The problem was that in case of a document with borders, the pgSz attribute
98 : * was exported as a child of pgBorders, thus being ignored on reload.
99 : * We assert dimension against A4 size in mm (to avoid minor rounding errors)
100 : */
101 2 : uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
102 2 : CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect Page Width (mm)", sal_Int32(210), getProperty<sal_Int32>(xPageStyle, "Width") / 100);
103 2 : CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect Page Height (mm)", sal_Int32(297), getProperty<sal_Int32>(xPageStyle, "Height") / 100);
104 2 : }
105 :
106 17 : DECLARE_OOXMLEXPORT_TEST(testFdo68787, "fdo68787.docx")
107 : {
108 2 : uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
109 : // This was 25, the 'lack of w:separator' <-> '0 line width' mapping was missing.
110 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth"));
111 2 : }
112 :
113 16 : DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt")
114 : {
115 1 : uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY);
116 : // OOXML has just one border attribute (<w:bdr>) for text border so all side has
117 : // the same border with the same padding
118 : // Border
119 : {
120 1 : const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
121 1 : CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder);
122 1 : CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
123 1 : CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
124 1 : CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
125 : }
126 :
127 : // Padding (w:space)
128 : {
129 1 : const sal_Int32 nTopPadding = getProperty<sal_Int32>(xRun,"CharTopBorderDistance");
130 : // In the original ODT the padding is 150, but the unit conversion round it down.
131 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(141), nTopPadding);
132 1 : CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharLeftBorderDistance"));
133 1 : CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharBottomBorderDistance"));
134 1 : CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharRightBorderDistance"));
135 : }
136 :
137 : // Shadow (w:shadow)
138 : /* OOXML use just one bool value for shadow so the next conversions
139 : are made during an export-import round
140 : color: any -> black
141 : location: any -> bottom-right
142 : width: any -> border width */
143 : {
144 1 : const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
145 1 : CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
146 1 : CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
147 1 : CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
148 : }
149 :
150 : // Also check shadow when it is in middle of the paragraph
151 : // (problem can be during export with SwWW8AttrIter::HasTextItem())
152 : {
153 1 : uno::Reference<beans::XPropertySet> xMiddleRun(getRun(getParagraph(2),2), uno::UNO_QUERY);
154 1 : const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xMiddleRun, "CharShadowFormat");
155 1 : CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
156 1 : CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
157 1 : CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
158 : }
159 :
160 1 : if (xmlDocPtr pXmlStyles = parseExport("word/styles.xml"))
161 : {
162 : // Make sure we write qFormat for custom style names.
163 1 : assertXPath(pXmlStyles, "//w:style[@w:styleId='Heading']/w:qFormat", 1);
164 1 : }
165 1 : }
166 :
167 17 : DECLARE_OOXMLEXPORT_TEST(testStyleInheritance, "style-inheritance.docx")
168 : {
169 : // Check that now styleId's are more like what MSO produces
170 2 : xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
171 2 : if (!pXmlStyles)
172 3 : return;
173 : // the 1st style always must be Normal
174 1 : assertXPath(pXmlStyles, "/w:styles/w:style[1]", "styleId", "Normal");
175 : // some random style later
176 1 : assertXPath(pXmlStyles, "/w:styles/w:style[4]", "styleId", "Heading3");
177 :
178 : // Check that we do _not_ export w:next for styles that point to themselves.
179 1 : assertXPath(pXmlStyles, "/w:styles/w:style[1]/w:next", 0);
180 :
181 : // Check that we roundtrip <w:next> correctly - on XML level
182 1 : assertXPath(pXmlStyles, "/w:styles/w:style[2]/w:next", "val", "Normal");
183 : // And to be REALLY sure, check it on the API level too ;-)
184 1 : uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles");
185 2 : uno::Reference< beans::XPropertySet > properties(paragraphStyles->getByName("Heading 1"), uno::UNO_QUERY);
186 1 : CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty<OUString>(properties, "FollowStyle"));
187 :
188 : // This was 0, as export of w:outlineLvl was missing.
189 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(properties, "OutlineLevel"));
190 :
191 1 : properties = uno::Reference< beans::XPropertySet >(paragraphStyles->getByName("Heading 11"), uno::UNO_QUERY);
192 1 : CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty<OUString>(properties, "FollowStyle"));
193 :
194 : // Make sure style #2 is Heading 1.
195 1 : assertXPath(pXmlStyles, "/w:styles/w:style[2]", "styleId", "Heading1");
196 : // w:ind was copied from the parent (Normal) style without a good reason.
197 1 : assertXPath(pXmlStyles, "/w:styles/w:style[2]/w:pPr/w:ind", 0);
198 :
199 : // We output exactly 2 properties in rPrDefault, nothing else was
200 : // introduced as an additional default
201 1 : assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/*", 2);
202 : // Check that we output real content of rPrDefault
203 1 : assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "ascii", "Times New Roman");
204 1 : assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:lang", "bidi", "ar-SA");
205 : // pPrDefault is empty
206 1 : assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:pPrDefault/w:pPr/*", 0);
207 :
208 : // Check latent styles
209 2 : uno::Sequence<beans::PropertyValue> aGrabBag = getProperty< uno::Sequence<beans::PropertyValue> >(mxComponent, "InteropGrabBag");
210 2 : uno::Sequence<beans::PropertyValue> aLatentStyles;
211 13 : for (sal_Int32 i = 0; i < aGrabBag.getLength(); ++i)
212 12 : if (aGrabBag[i].Name == "latentStyles")
213 1 : aGrabBag[i].Value >>= aLatentStyles;
214 1 : CPPUNIT_ASSERT(aLatentStyles.getLength()); // document should have latent styles
215 :
216 : // Check latent style default attributes
217 2 : OUString aCount;
218 2 : uno::Sequence<beans::PropertyValue> aLatentStyleExceptions;
219 8 : for (sal_Int32 i = 0; i < aLatentStyles.getLength(); ++i)
220 : {
221 7 : if (aLatentStyles[i].Name == "count")
222 1 : aCount = aLatentStyles[i].Value.get<OUString>();
223 6 : else if (aLatentStyles[i].Name == "lsdExceptions")
224 1 : aLatentStyles[i].Value >>= aLatentStyleExceptions;
225 : }
226 1 : CPPUNIT_ASSERT_EQUAL(OUString("371"), aCount); // This check the "count" attribute.
227 :
228 : // Check exceptions to the latent style defaults.
229 2 : uno::Sequence<beans::PropertyValue> aLatentStyleException;
230 1 : aLatentStyleExceptions[0].Value >>= aLatentStyleException;
231 2 : OUString aName;
232 4 : for (sal_Int32 i = 0; i < aLatentStyleException.getLength(); ++i)
233 3 : if (aLatentStyleException[i].Name == "name")
234 1 : aName = aLatentStyleException[i].Value.get<OUString>();
235 1 : CPPUNIT_ASSERT_EQUAL(OUString("Normal"), aName); // This checks the "name" attribute of the first exception.
236 :
237 : // This numbering style wasn't roundtripped.
238 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoList']/w:name", "val", "No List");
239 :
240 : // Table style wasn't roundtripped.
241 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:tblPr/w:tblCellMar/w:left", "w", "108");
242 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:semiHidden", 1);
243 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:unhideWhenUsed", 1);
244 :
245 : // Additional para style properties should be also roundtripped.
246 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListParagraph']/w:uiPriority", "val", "34");
247 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:qFormat", 1);
248 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:rsid", "val", "00780346");
249 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']", "default", "1");
250 :
251 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:link", "val", "Heading1Char");
252 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:locked", 1);
253 :
254 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading11']", "customStyle", "1");
255 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading11']/w:autoRedefine", 1);
256 :
257 : // Additional char style properties should be also roundtripped.
258 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='DefaultParagraphFont']", "default", "1");
259 :
260 : // Finally check the same for numbering styles.
261 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoList']", "default", "1");
262 :
263 : // This was 1, the default style had <w:suppressAutoHyphens w:val="true"/> even for a default style having no RES_PARATR_HYPHENZONE set.
264 2 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:pPr/w:suppressAutoHyphens", 0);
265 : }
266 :
267 17 : DECLARE_OOXMLEXPORT_TEST(testCalendar1, "calendar1.docx")
268 : {
269 : // Document has a non-trivial table style, test the roundtrip of it.
270 2 : xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
271 2 : if (!pXmlStyles)
272 3 : return;
273 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:basedOn", "val", "TableNormal");
274 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:rsid", "val", "00903003");
275 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblPr/w:tblStyleColBandSize", "val", "1");
276 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tcPr/w:shd", "val", "clear");
277 :
278 : // Table style lost its paragraph / run properties.
279 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:pPr/w:spacing", "lineRule", "auto");
280 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:rPr/w:lang", "eastAsia", "ja-JP");
281 :
282 : // Table style lost its conditional table formatting properties.
283 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:pPr/w:wordWrap", 1);
284 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:rFonts", "hAnsiTheme", "minorHAnsi");
285 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:tblPr", 1);
286 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:tcPr/w:vAlign", "val", "bottom");
287 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='lastRow']/w:tcPr/w:tcBorders/w:tr2bl", "val", "nil");
288 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='band2Horz']/w:tcPr/w:tcBorders/w:top", "themeColor", "text1");
289 :
290 : // w:tblLook element and its attributes were missing.
291 1 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
292 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "firstRow", "1");
293 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "lastRow", "0");
294 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "lastColumn", "0");
295 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "firstColumn", "1");
296 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "noHBand", "0");
297 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "noVBand", "1");
298 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "val", "04a0");
299 : }
300 :
301 17 : DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx")
302 : {
303 : // Problem was that CharCaseMap was style::CaseMap::NONE.
304 2 : uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
305 3 : uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
306 2 : CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharCaseMap"));
307 : // Font size in the second row was 11.
308 2 : xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
309 2 : CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight"));
310 : // Font size in the third row was 11 as well.
311 2 : xCell.set(xTable->getCellByName("B3"), uno::UNO_QUERY);
312 2 : CPPUNIT_ASSERT_EQUAL(14.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight"));
313 :
314 : // This paragraph property was missing in table style.
315 2 : xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
316 2 : if (!pXmlStyles)
317 3 : return;
318 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:pPr/w:jc", "val", "center");
319 :
320 : // These run properties were missing
321 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:rPr/w:lang", "val", "en-US");
322 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:rPr/w:lang", "bidi", "ar-SA");
323 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:caps", 1);
324 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:smallCaps", "val", "0");
325 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:color", "themeColor", "accent1");
326 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:spacing", "val", "20");
327 :
328 : // Table borders were also missing
329 2 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblPr/w:tblBorders/w:insideV", "themeTint", "99");
330 : }
331 :
332 17 : DECLARE_OOXMLEXPORT_TEST(testTcBorders, "testTcBorders.docx")
333 : {
334 : //fdo#76635 : Table borders are not getting preserved.
335 :
336 2 : xmlDocPtr pXmlDocument = parseExport("word/document.xml");
337 2 : if (!pXmlDocument)
338 3 : return;
339 :
340 1 : assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:val = 'single']",1);
341 1 : assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:sz = 4]", 1);
342 1 : assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:space = 0]", 1);
343 1 : assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:color = 808080]", 1);
344 :
345 : }
346 :
347 17 : DECLARE_OOXMLEXPORT_TEST(testQuicktables, "quicktables.docx")
348 : {
349 2 : xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
350 2 : if (!pXmlStyles)
351 3 : return;
352 :
353 : // These were missing in the Calendar3 table style.
354 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:rPr/w:rFonts", "cstheme", "majorBidi");
355 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:rPr/w:color", "themeTint", "80");
356 1 : CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:color", "themeShade").equalsIgnoreAsciiCase("BF"));
357 :
358 : // Calendar4.
359 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:pPr/w:snapToGrid", "val", "0");
360 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:rPr/w:bCs", 1);
361 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tcPr/w:shd", "themeFill", "accent1");
362 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tcPr/w:shd", "themeFillShade", "80");
363 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='firstCol']/w:pPr/w:ind", "rightChars", "0");
364 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='firstCol']/w:pPr/w:ind", "right", "144");
365 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='band2Horz']/w:tcPr/w:tcMar/w:bottom", "w", "86");
366 :
367 : // LightList.
368 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='LightList']/w:tblStylePr[@w:type='firstRow']/w:pPr/w:spacing", "before", "0");
369 :
370 : // MediumList2-Accent1.
371 1 : CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumList2-Accent1']/w:tblStylePr[@w:type='band1Vert']/w:tcPr/w:shd", "themeFillTint").equalsIgnoreAsciiCase("3F"));
372 :
373 : // MediumShading2-Accent5.
374 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumShading2-Accent5']/w:tblStylePr[@w:type='firstRow']/w:tcPr/w:tcBorders/w:top", "color", "auto");
375 : }
376 :
377 17 : DECLARE_OOXMLEXPORT_TEST(testFdo71302, "fdo71302.docx")
378 : {
379 2 : xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
380 2 : if (!pXmlStyles)
381 3 : return;
382 :
383 : // This got renamed to "Strong Emphasis" without a good reason.
384 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Strong']", 1);
385 : }
386 :
387 :
388 :
389 :
390 :
391 17 : DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
392 : {
393 2 : uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
394 4 : uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
395 4 : uno::Sequence<beans::PropertyValue> aGrabBag(0);
396 2 : xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
397 2 : CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
398 :
399 2 : bool bTheme = false;
400 26 : for(int i = 0; i < aGrabBag.getLength(); ++i)
401 : {
402 24 : if (aGrabBag[i].Name == "OOXTheme")
403 : {
404 2 : bTheme = true;
405 2 : uno::Reference<xml::dom::XDocument> aThemeDom;
406 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aThemeDom); // PropertyValue of proper type
407 2 : CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty
408 : }
409 : }
410 2 : CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements
411 :
412 4 : uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
413 4 : uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
414 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
415 :
416 4 : uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
417 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xGroup->getCount()); // 1 rendered bitmap from the original shapes
418 :
419 4 : uno::Reference<beans::XPropertySet> xGroupPropertySet(getShape(1), uno::UNO_QUERY);
420 2 : xGroupPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
421 2 : CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
422 :
423 2 : bool bData = false, bLayout = false, bQStyle = false, bColor = false, bDrawing = false;
424 12 : for(int i = 0; i < aGrabBag.getLength(); ++i)
425 : {
426 10 : if (aGrabBag[i].Name == "OOXData")
427 : {
428 2 : bData = true;
429 2 : uno::Reference<xml::dom::XDocument> aDataDom;
430 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aDataDom); // PropertyValue of proper type
431 2 : CPPUNIT_ASSERT(aDataDom.get()); // Reference not empty
432 : }
433 8 : else if (aGrabBag[i].Name == "OOXLayout")
434 : {
435 2 : bLayout = true;
436 2 : uno::Reference<xml::dom::XDocument> aLayoutDom;
437 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aLayoutDom); // PropertyValue of proper type
438 2 : CPPUNIT_ASSERT(aLayoutDom.get()); // Reference not empty
439 : }
440 6 : else if (aGrabBag[i].Name == "OOXStyle")
441 : {
442 2 : bQStyle = true;
443 2 : uno::Reference<xml::dom::XDocument> aStyleDom;
444 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aStyleDom); // PropertyValue of proper type
445 2 : CPPUNIT_ASSERT(aStyleDom.get()); // Reference not empty
446 : }
447 4 : else if (aGrabBag[i].Name == "OOXColor")
448 : {
449 2 : bColor = true;
450 2 : uno::Reference<xml::dom::XDocument> aColorDom;
451 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aColorDom); // PropertyValue of proper type
452 2 : CPPUNIT_ASSERT(aColorDom.get()); // Reference not empty
453 : }
454 2 : else if (aGrabBag[i].Name == "OOXDrawing")
455 : {
456 2 : bDrawing = true;
457 2 : uno::Sequence< uno::Any > diagramDrawing;
458 4 : uno::Reference<xml::dom::XDocument> aDrawingDom;
459 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= diagramDrawing);
460 2 : CPPUNIT_ASSERT(diagramDrawing[0] >>= aDrawingDom); // PropertyValue of proper type
461 4 : CPPUNIT_ASSERT(aDrawingDom.get()); // Reference not empty
462 : }
463 : }
464 2 : CPPUNIT_ASSERT(bData && bLayout && bQStyle && bColor && bDrawing); // Grab Bag has all the expected elements
465 :
466 4 : uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(0), uno::UNO_QUERY);
467 4 : OUString nValue;
468 2 : xPropertySet->getPropertyValue("Name") >>= nValue;
469 4 : CPPUNIT_ASSERT_EQUAL(OUString("RenderedShapes"), nValue); // Rendered bitmap has the proper name
470 2 : }
471 :
472 17 : DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
473 : {
474 : // Check no empty font name is exported
475 : // This test does not fail, if the document contains a font with empty name.
476 :
477 2 : xmlDocPtr pXmlFontTable = parseExport("word/fontTable.xml");
478 2 : if (!pXmlFontTable)
479 3 : return;
480 1 : xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlFontTable, "/w:fonts/w:font");
481 1 : xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
482 1 : sal_Int32 length = xmlXPathNodeSetGetLength(pXmlNodes);
483 11 : for(sal_Int32 index = 0; index < length; index++){
484 10 : xmlNodePtr pXmlNode = pXmlNodes->nodeTab[index];
485 10 : OUString attrVal = OUString::createFromAscii(reinterpret_cast<char*>(xmlGetProp(pXmlNode, BAD_CAST("name"))));
486 10 : if (attrVal.isEmpty()){
487 0 : CPPUNIT_FAIL("Font name is empty.");
488 : }
489 10 : }
490 1 : xmlXPathFreeObject(pXmlObj);
491 : }
492 :
493 17 : DECLARE_OOXMLEXPORT_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx")
494 : {
495 : // Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
496 2 : xmlDocPtr pXmlDoc = parseExport();
497 2 : if (!pXmlDoc)
498 3 : return;
499 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:sectPr/w:cols","sep","false");
500 : }
501 :
502 17 : DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx")
503 : {
504 : // The problem was that item[n].xml and itemProps[n].xml and .rels files for item[n].xml
505 : // files were missing from docx file after saving file.
506 : // This test case tests whether customxml files grabbagged properly in correct object.
507 :
508 2 : uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
509 4 : uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
510 4 : uno::Sequence<beans::PropertyValue> aGrabBag(0);
511 2 : xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
512 2 : CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
513 2 : bool CustomXml = false;
514 26 : for(int i = 0; i < aGrabBag.getLength(); ++i)
515 : {
516 24 : if (aGrabBag[i].Name == "OOXCustomXml" || aGrabBag[i].Name == "OOXCustomXmlProps")
517 : {
518 4 : CustomXml = true;
519 4 : uno::Reference<xml::dom::XDocument> aCustomXmlDom;
520 8 : uno::Sequence<uno::Reference<xml::dom::XDocument> > aCustomXmlDomList;
521 4 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aCustomXmlDomList); // PropertyValue of proper type
522 4 : sal_Int32 length = aCustomXmlDomList.getLength();
523 4 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), length);
524 4 : aCustomXmlDom = aCustomXmlDomList[0];
525 8 : CPPUNIT_ASSERT(aCustomXmlDom.get()); // Reference not empty
526 : }
527 : }
528 4 : CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements
529 2 : }
530 :
531 17 : DECLARE_OOXMLEXPORT_TEST(testActiveXGrabBag, "activex.docx")
532 : {
533 : // The problem was that activeX.xml files were missing from docx file after saving file.
534 : // This test case tests whether activex files grabbagged properly in correct object.
535 :
536 2 : uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
537 4 : uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
538 4 : uno::Sequence<beans::PropertyValue> aGrabBag(0);
539 2 : xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
540 2 : CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
541 2 : bool bActiveX = false;
542 26 : for(int i = 0; i < aGrabBag.getLength(); ++i)
543 : {
544 24 : if (aGrabBag[i].Name == "OOXActiveX")
545 : {
546 2 : bActiveX = true;
547 2 : uno::Reference<xml::dom::XDocument> aActiveXDom;
548 4 : uno::Sequence<uno::Reference<xml::dom::XDocument> > aActiveXDomList;
549 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aActiveXDomList); // PropertyValue of proper type
550 2 : sal_Int32 length = aActiveXDomList.getLength();
551 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(5), length);
552 2 : aActiveXDom = aActiveXDomList[0];
553 4 : CPPUNIT_ASSERT(aActiveXDom.get()); // Reference not empty
554 : }
555 : }
556 4 : CPPUNIT_ASSERT(bActiveX); // Grab Bag has all the expected elements
557 2 : }
558 :
559 17 : DECLARE_OOXMLEXPORT_TEST(testActiveXBinGrabBag, "activexbin.docx")
560 : {
561 : // The problem was that activeX.bin files were missing from docx file after saving file.
562 : // This test case tests whether activex bin files grabbagged properly in correct object.
563 :
564 2 : uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
565 4 : uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
566 4 : uno::Sequence<beans::PropertyValue> aGrabBag(0);
567 2 : xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
568 2 : CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
569 2 : bool bActiveX = false;
570 26 : for(int i = 0; i < aGrabBag.getLength(); ++i)
571 : {
572 24 : if (aGrabBag[i].Name == "OOXActiveXBin")
573 : {
574 2 : bActiveX = true;
575 2 : uno::Reference<io::XInputStream> aActiveXBin;
576 4 : uno::Sequence<uno::Reference<io::XInputStream> > aActiveXBinList;
577 2 : CPPUNIT_ASSERT(aGrabBag[i].Value >>= aActiveXBinList); // PropertyValue of proper type
578 2 : sal_Int32 length = aActiveXBinList.getLength();
579 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(5), length);
580 2 : aActiveXBin = aActiveXBinList[0];
581 4 : CPPUNIT_ASSERT(aActiveXBin.get()); // Reference not empty
582 : }
583 : }
584 4 : CPPUNIT_ASSERT(bActiveX); // Grab Bag has all the expected elements
585 2 : }
586 :
587 17 : DECLARE_OOXMLEXPORT_TEST(testFdo69644, "fdo69644.docx")
588 : {
589 : // The problem was that the exporter exported the table definition
590 : // with only 3 columns, instead of 5 columns.
591 : // Check that the table grid is exported with 5 columns
592 2 : xmlDocPtr pXmlDoc = parseExport();
593 2 : if (!pXmlDoc)
594 3 : return;
595 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 5);
596 : }
597 :
598 17 : DECLARE_OOXMLEXPORT_TEST(testFdo70812, "fdo70812.docx")
599 : {
600 : // Import just crashed.
601 2 : getParagraph(1, "Sample pages document.");
602 2 : }
603 :
604 17 : DECLARE_OOXMLEXPORT_TEST(testPgMargin, "testPgMargin.docx")
605 : {
606 2 : xmlDocPtr pXmlDoc = parseExport();
607 2 : if (!pXmlDoc)
608 3 : return;
609 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "left", "1440");
610 : }
611 :
612 17 : DECLARE_OOXMLEXPORT_TEST(testImageCrop, "ImageCrop.docx")
613 : {
614 2 : uno::Reference<drawing::XShape> image = getShape(1);
615 4 : uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
616 2 : ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
617 :
618 2 : imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
619 :
620 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 2955 ), aGraphicCropStruct.Left );
621 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 5477 ), aGraphicCropStruct.Right );
622 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 2856 ), aGraphicCropStruct.Top );
623 4 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 2291 ), aGraphicCropStruct.Bottom );
624 2 : }
625 :
626 17 : DECLARE_OOXMLEXPORT_TEST(testLineSpacingexport, "test_line_spacing.docx")
627 : {
628 : // The Problem was that the w:line attribute value in w:spacing tag was incorrect
629 2 : uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
630 4 : uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
631 4 : uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
632 4 : CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
633 :
634 : // FIXME The test passes on most machines (including Linux x86_64 with gcc-4.7), but fails on various configs:
635 : // Linux arm, Linux x86_64 with gcc-4.8 and Mac. Need to figure out what goes wrong and fix that.
636 : #if 0
637 : style::LineSpacing alineSpacing = getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing");
638 : CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(13200), static_cast<sal_Int16>(alineSpacing.Height));
639 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
640 : if (!pXmlDoc)
641 : return;
642 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "line", "31680");
643 : #endif
644 2 : }
645 :
646 17 : DECLARE_OOXMLEXPORT_TEST(testTextBoxGradientAngle, "fdo65295.docx")
647 : {
648 2 : uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
649 4 : uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
650 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndexAccess->getCount());
651 :
652 : // Angle of frame#1 is 135 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
653 4 : uno::Reference<beans::XPropertySet> xFrame1(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
654 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame1, "FillStyle"));
655 2 : awt::Gradient aGradient1 = getProperty<awt::Gradient>(xFrame1, "FillGradient");
656 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16(135 * 10), aGradient1.Angle);
657 :
658 : // Angle of frame#2 is 180 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
659 4 : uno::Reference<beans::XPropertySet> xFrame2(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
660 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame2, "FillStyle"));
661 2 : awt::Gradient aGradient2 = getProperty<awt::Gradient>(xFrame2, "FillGradient");
662 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16(180 * 10), aGradient2.Angle);
663 :
664 : // Angle of frame#3 is 90 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
665 4 : uno::Reference<beans::XPropertySet> xFrame3(xIndexAccess->getByIndex(2), uno::UNO_QUERY);
666 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame3, "FillStyle"));
667 2 : awt::Gradient aGradient3 = getProperty<awt::Gradient>(xFrame3, "FillGradient");
668 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16( 90 * 10), aGradient3.Angle);
669 :
670 : // Angle of frame#4 is 225 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
671 4 : uno::Reference<beans::XPropertySet> xFrame4(xIndexAccess->getByIndex(3), uno::UNO_QUERY);
672 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame4, "FillStyle"));
673 2 : awt::Gradient aGradient4 = getProperty<awt::Gradient>(xFrame4, "FillGradient");
674 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16(225 * 10), aGradient4.Angle);
675 :
676 : // Angle of frame#5 is 270 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
677 4 : uno::Reference<beans::XPropertySet> xFrame5(xIndexAccess->getByIndex(4), uno::UNO_QUERY);
678 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame5, "FillStyle"));
679 2 : awt::Gradient aGradient5 = getProperty<awt::Gradient>(xFrame5, "FillGradient");
680 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16(270 * 10), aGradient5.Angle);
681 :
682 : // Angle of frame#6 is 315 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
683 4 : uno::Reference<beans::XPropertySet> xFrame6(xIndexAccess->getByIndex(5), uno::UNO_QUERY);
684 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame6, "FillStyle"));
685 2 : awt::Gradient aGradient6 = getProperty<awt::Gradient>(xFrame6, "FillGradient");
686 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16(315 * 10), aGradient6.Angle);
687 :
688 : // Angle of frame#7 is 0 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
689 4 : uno::Reference<beans::XPropertySet> xFrame7(xIndexAccess->getByIndex(6), uno::UNO_QUERY);
690 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame7, "FillStyle"));
691 2 : awt::Gradient aGradient7 = getProperty<awt::Gradient>(xFrame7, "FillGradient");
692 2 : CPPUNIT_ASSERT_EQUAL(sal_Int16( 0 * 10), aGradient7.Angle);
693 :
694 : // Angle of frame#8 is 45 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
695 4 : uno::Reference<beans::XPropertySet> xFrame8(xIndexAccess->getByIndex(7), uno::UNO_QUERY);
696 2 : CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame8, "FillStyle"));
697 2 : awt::Gradient aGradient8 = getProperty<awt::Gradient>(xFrame8, "FillGradient");
698 4 : CPPUNIT_ASSERT_EQUAL(sal_Int16( 45 * 10), aGradient8.Angle);
699 2 : }
700 :
701 17 : DECLARE_OOXMLEXPORT_TEST(testCellGridSpan, "cell-grid-span.docx")
702 : {
703 : // The problem was during export gridSpan value for 1st & 2nd cells for test document
704 : // used to get set wrongly to 5 and 65532 respectively which was the reason for crash during save operation
705 : // Varifying gridSpan element is not present in RoundTriped Document (As it's Default value is 1).
706 2 : xmlDocPtr pXmlDoc = parseExport();
707 2 : if (!pXmlDoc)
708 3 : return;
709 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:gridSpan",0);
710 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:gridSpan",0);
711 : }
712 17 : DECLARE_OOXMLEXPORT_TEST(testFdo71646, "fdo71646.docx")
713 : {
714 : // The problem was after save file created by MS the direction changed to RTL.
715 2 : uno::Reference<uno::XInterface> xParaLTRLeft(getParagraph( 1, "LTR LEFT"));
716 2 : sal_Int32 nLTRLeft = getProperty< sal_Int32 >( xParaLTRLeft, "ParaAdjust" );
717 : // test the text Direction value for the pragraph
718 2 : sal_Int16 nLRDir = getProperty< sal_Int32 >( xParaLTRLeft, "WritingMode" );
719 :
720 : // this will test the both the text direction and alignment for paragraph
721 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nLTRLeft);
722 2 : CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir);
723 2 : }
724 :
725 17 : DECLARE_OOXMLEXPORT_TEST(testParaAutoSpacing, "para-auto-spacing.docx")
726 : {
727 2 : xmlDocPtr pXmlDoc = parseExport();
728 2 : if (!pXmlDoc)
729 3 : return;
730 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing","1");
731 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "afterAutospacing","1");
732 :
733 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "beforeAutospacing","");
734 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "afterAutospacing","");
735 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "before","400");
736 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "after","400");
737 : }
738 :
739 17 : DECLARE_OOXMLEXPORT_TEST(testGIFImageCrop, "test_GIF_ImageCrop.docx")
740 : {
741 : // FIXME why does this fail on Mac?
742 : #if !defined(MACOSX)
743 2 : uno::Reference<drawing::XShape> image = getShape(1);
744 4 : uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
745 2 : ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
746 :
747 2 : imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
748 :
749 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 1085 ), aGraphicCropStruct.Left );
750 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 3651 ), aGraphicCropStruct.Right );
751 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 953 ), aGraphicCropStruct.Top );
752 4 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 1244 ), aGraphicCropStruct.Bottom );
753 : #endif
754 2 : }
755 :
756 17 : DECLARE_OOXMLEXPORT_TEST(testPNGImageCrop, "test_PNG_ImageCrop.docx")
757 : {
758 : // FIXME why does this fail on Mac?
759 : #if !defined(MACOSX)
760 : /* The problem was image cropping information was not getting saved
761 : * after roundtrip.
762 : * Check for presenece of cropping parameters in exported file.
763 : */
764 2 : uno::Reference<drawing::XShape> image = getShape(1);
765 4 : uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
766 2 : ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
767 :
768 2 : imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
769 :
770 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 1058 ), aGraphicCropStruct.Left );
771 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 1111 ), aGraphicCropStruct.Right );
772 2 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 1164 ), aGraphicCropStruct.Top );
773 4 : CPPUNIT_ASSERT_EQUAL( sal_Int32( 635 ), aGraphicCropStruct.Bottom );
774 : #endif
775 2 : }
776 :
777 17 : DECLARE_OOXMLEXPORT_TEST(testFootnoteParagraphTag, "testFootnote.docx")
778 : {
779 : /* In footnotes.xml, the paragraph tag inside <w:footnote w:id="2"> was getting written into document.xml.
780 : * Check for, paragraph tag is correctly written into footnotes.xml.
781 : */
782 2 : xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml");
783 2 : if (!pXmlFootnotes)
784 3 : return;
785 1 : assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]","id","2");
786 1 : assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r/w:rPr/w:rStyle","val","Footnotereference");
787 : }
788 :
789 17 : DECLARE_OOXMLEXPORT_TEST(testSpacingLineRule,"table_lineRule.docx")
790 : {
791 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
792 2 : if (!pXmlDoc)
793 3 : return;
794 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "lineRule", "auto");
795 : }
796 :
797 17 : DECLARE_OOXMLEXPORT_TEST(testTableLineSpacing, "table_atleast.docx")
798 : {
799 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
800 2 : if (!pXmlDoc)
801 3 : return;
802 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:spacing", "line", "320");
803 : }
804 :
805 17 : DECLARE_OOXMLEXPORT_TEST(testOoxmlTriangle, "ooxml-triangle.docx")
806 : {
807 : // The problem was that ooxml-triangle shape type wasn't handled by VML
808 : // export (only isosceles-triangle), leading to a missing shape.
809 2 : getShape(1);
810 2 : }
811 :
812 17 : DECLARE_OOXMLEXPORT_TEST(testMce, "mce.docx")
813 : {
814 : // The shape is red in Word2007, green in Word2010. Check that our import follows the later.
815 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(0x9bbb59), getProperty<sal_Int32>(getShape(1), "FillColor"));
816 2 : }
817 :
818 17 : DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx")
819 : {
820 : // check default font theme values have been preserved
821 2 : xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
822 2 : if (!pXmlStyles)
823 2 : return;
824 1 : assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "asciiTheme", "minorHAnsi");
825 1 : assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "cstheme", "minorBidi");
826 :
827 : // check the font theme values in style definitions
828 1 : assertXPath(pXmlStyles, "/w:styles/w:style[1]/w:rPr/w:rFonts", "eastAsiaTheme", "minorEastAsia");
829 :
830 : // check the color theme values in style definitions
831 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeColor", "accent1");
832 1 : assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeTint", "99");
833 :
834 : // check direct format font theme values have been preserved
835 1 : xmlDocPtr pXmlDocument = parseExport("word/document.xml");
836 1 : if (!pXmlDocument)
837 0 : return;
838 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:r[1]/w:rPr/w:rFonts", "hAnsiTheme", "majorHAnsi");
839 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:r[1]/w:rPr/w:rFonts", "asciiTheme", "majorHAnsi");
840 :
841 : // check theme font color value has been preserved
842 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color", "themeColor", "accent3");
843 1 : OUString sThemeShade = getXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color", "themeShade");
844 1 : CPPUNIT_ASSERT_EQUAL(sal_Int32(0xbf), sThemeShade.toInt32(16));
845 :
846 : // check the themeFontLang values in settings file
847 1 : xmlDocPtr pXmlSettings = parseExport("word/settings.xml");
848 1 : if (!pXmlSettings)
849 0 : return;
850 1 : assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "val", "en-US");
851 1 : assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "eastAsia", "zh-CN");
852 1 : assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "bidi", "he-IL");
853 :
854 : // check fonts have been applied properly
855 : sal_Unicode fontName[2]; //represents the string "宋体"
856 1 : fontName[0] = 0x5b8b;
857 1 : fontName[1] = 0x4f53;
858 1 : CPPUNIT_ASSERT_EQUAL(OUString(fontName, 2), getProperty<OUString>(getParagraph(1), "CharFontNameAsian"));
859 2 : CPPUNIT_ASSERT_EQUAL(OUString("Arial"),
860 1 : getProperty<OUString>(getParagraph(2), "CharFontNameComplex"));
861 2 : CPPUNIT_ASSERT_EQUAL(OUString("Trebuchet MS"),
862 1 : getProperty<OUString>(getParagraph(3, "Default style theme font"), "CharFontName"));
863 2 : CPPUNIT_ASSERT_EQUAL(OUString("Arial Black"),
864 1 : getProperty<OUString>(getRun(getParagraph(4, "Direct format font"), 1), "CharFontName"));
865 2 : CPPUNIT_ASSERT_EQUAL(OUString("Trebuchet MS"),
866 1 : getProperty<OUString>(getParagraph(5, "Major theme font"), "CharFontName"));
867 :
868 : // check the paragraph background pattern has been preserved including theme colors
869 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "val", "thinHorzStripe");
870 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeFill", "text2");
871 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeFillTint", "33");
872 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeColor", "accent1");
873 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeShade", "80");
874 : }
875 :
876 17 : DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.docx")
877 : {
878 2 : xmlDocPtr pXmlDocument = parseExport("word/document.xml");
879 2 : if (!pXmlDocument)
880 3 : return;
881 :
882 : // check cell theme colors have been preserved
883 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFill", "accent6");
884 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillShade", "");
885 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillTint", "33");
886 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFill", "accent6");
887 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillShade", "");
888 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillTint", "");
889 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFill", "accent6");
890 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillShade", "80");
891 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillTint", "");
892 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "val", "horzStripe");
893 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeColor", "accent3");
894 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeTint", "33");
895 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "color", "E7EEEE");
896 :
897 : // check table style has been preserved
898 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tblPr/w:tblStyle", "val", "Sombreadoclaro-nfasis1");
899 : // check table style is not overwritten by other properties
900 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/*", 0);
901 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/*", 0);
902 : // check that one cell attribute present in the original document has been preserved
903 1 : assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/*", 1);
904 :
905 : // Check that w:cnfStyle row, cell and paragraph property is preserved.
906 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "val", "100000000000");
907 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "firstRow", "1");
908 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "lastRow", "0");
909 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "firstColumn", "0");
910 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "lastColumn", "0");
911 :
912 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "val", "001000000000");
913 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "oddVBand", "0");
914 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "evenVBand", "0");
915 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "oddHBand", "0");
916 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "evenHBand", "0");
917 :
918 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "val", "100000000000");
919 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "firstRowFirstColumn", "0");
920 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "firstRowLastColumn", "0");
921 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "lastRowFirstColumn", "0");
922 1 : assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "lastRowLastColumn", "0");
923 :
924 : }
925 :
926 17 : DECLARE_OOXMLEXPORT_TEST(testcantSplit, "2_table_doc.docx")
927 : {
928 : // if Split table value is true for a table then during export do not write <w:cantSplit w:val="false"/>
929 : // in table row property,As default row prop is allow row to break across page.
930 : // writing <w:cantSplit w:val="false"/> during export was causing problem that all the cell data used to come on same page
931 2 : xmlDocPtr pXmlDoc = parseExport();
932 2 : if (!pXmlDoc)
933 3 : return;
934 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:cantSplit",0);
935 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:cantSplit","val","true");
936 : }
937 :
938 17 : DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx")
939 : {
940 : // There was a problem for some documents during export.Invalid sectPr getting added
941 : // because of faulty calculation of PageDesc value
942 : // This was the reason for increasing number of pages after RT
943 2 : uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
944 4 : uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
945 4 : uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
946 2 : xCursor->jumpToLastPage();
947 4 : CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
948 2 : }
949 :
950 17 : DECLARE_OOXMLEXPORT_TEST(testcolumnbreak, "columnbreak.docx")
951 : {
952 2 : CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(5, "This is first line after col brk."), "BreakType"));
953 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
954 2 : if (!pXmlDoc)
955 3 : return;
956 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:br", "type", "column");
957 : }
958 :
959 17 : DECLARE_OOXMLEXPORT_TEST(testGlossary, "testGlossary.docx")
960 : {
961 2 : xmlDocPtr pXmlDoc = parseExport("word/glossary/document.xml");
962 2 : if (!pXmlDoc)
963 3 : return;
964 1 : assertXPath(pXmlDoc, "/w:glossaryDocument", "Ignorable", "w14 wp14");
965 : }
966 :
967 17 : DECLARE_OOXMLEXPORT_TEST(testFdo71785, "fdo71785.docx")
968 : {
969 : // crashtest
970 2 : }
971 :
972 17 : DECLARE_OOXMLEXPORT_TEST(testCrashWhileSave, "testCrashWhileSave.docx")
973 : {
974 2 : xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
975 2 : if (!pXmlDoc)
976 3 : return;
977 1 : CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:ftr/w:tbl/w:tr/w:tc[1]/w:p[1]/w:pPr/w:pStyle", "val").match("Normal"));
978 : }
979 :
980 17 : DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx")
981 : {
982 : // Docx containing Floating table with formula was giving "General input/output error" while opening in LibreOffice
983 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
984 2 : if (!pXmlDoc)
985 3 : return;
986 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal");
987 : }
988 :
989 : #endif
990 :
991 4 : CPPUNIT_PLUGIN_IMPLEMENT();
992 :
993 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|