2012-02-11 17:06:42 +01:00
|
|
|
/*
|
2013-04-19 21:10:42 +01:00
|
|
|
* This file is part of the LibreOffice project.
|
2012-02-11 17:06:42 +01:00
|
|
|
*
|
2013-04-19 21:10:42 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2012-02-11 17:06:42 +01:00
|
|
|
*/
|
|
|
|
|
2012-10-17 10:09:57 +02:00
|
|
|
#include <com/sun/star/document/XFilter.hpp>
|
|
|
|
#include <com/sun/star/document/XImporter.hpp>
|
2012-09-19 15:45:12 +02:00
|
|
|
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
|
2012-10-18 09:09:03 +02:00
|
|
|
#include <com/sun/star/drawing/LineStyle.hpp>
|
2012-02-11 17:06:42 +01:00
|
|
|
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
|
2012-06-11 17:55:21 +02:00
|
|
|
#include <com/sun/star/graphic/GraphicType.hpp>
|
2012-02-21 18:25:37 +01:00
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
2012-03-24 17:14:12 +01:00
|
|
|
#include <com/sun/star/style/CaseMap.hpp>
|
2012-04-21 12:53:22 +02:00
|
|
|
#include <com/sun/star/style/LineSpacing.hpp>
|
|
|
|
#include <com/sun/star/style/LineSpacingMode.hpp>
|
2012-02-22 13:05:37 +01:00
|
|
|
#include <com/sun/star/table/BorderLine2.hpp>
|
|
|
|
#include <com/sun/star/table/BorderLineStyle.hpp>
|
2012-02-21 18:25:37 +01:00
|
|
|
#include <com/sun/star/text/RelOrientation.hpp>
|
2012-02-18 23:05:52 +01:00
|
|
|
#include <com/sun/star/text/SizeType.hpp>
|
2012-11-13 17:30:18 +01:00
|
|
|
#include <com/sun/star/text/TableColumnSeparator.hpp>
|
2012-03-24 13:04:54 +01:00
|
|
|
#include <com/sun/star/text/TextContentAnchorType.hpp>
|
2012-04-03 16:49:41 +02:00
|
|
|
#include <com/sun/star/text/XFootnotesSupplier.hpp>
|
2012-03-16 14:23:36 +01:00
|
|
|
#include <com/sun/star/text/XPageCursor.hpp>
|
2012-02-11 17:06:42 +01:00
|
|
|
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
|
2012-04-25 17:51:45 +02:00
|
|
|
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
|
2012-02-18 23:05:52 +01:00
|
|
|
#include <com/sun/star/text/XTextFramesSupplier.hpp>
|
2013-04-10 11:55:22 +02:00
|
|
|
#include <com/sun/star/text/XTextRangeCompare.hpp>
|
2012-03-30 10:44:09 +02:00
|
|
|
#include <com/sun/star/text/XTextTablesSupplier.hpp>
|
2012-07-27 21:20:34 +02:00
|
|
|
#include <com/sun/star/text/XTextTable.hpp>
|
2012-03-16 14:23:36 +01:00
|
|
|
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
|
2012-09-19 15:45:12 +02:00
|
|
|
#include <com/sun/star/text/WrapTextMode.hpp>
|
2013-06-15 19:05:50 +02:00
|
|
|
#include <com/sun/star/text/HoriOrientation.hpp>
|
|
|
|
#include <com/sun/star/text/VertOrientation.hpp>
|
2012-04-25 17:51:45 +02:00
|
|
|
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
2012-02-11 17:06:42 +01:00
|
|
|
|
2012-09-17 17:11:09 -05:00
|
|
|
#include <rtl/ustring.hxx>
|
2012-02-11 17:06:42 +01:00
|
|
|
#include <vcl/outdev.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2012-10-17 10:09:57 +02:00
|
|
|
#include <unotools/ucbstreamhelper.hxx>
|
|
|
|
#include <unotools/streamwrap.hxx>
|
2012-02-11 17:06:42 +01:00
|
|
|
|
2012-11-18 11:07:45 +01:00
|
|
|
#include <swmodeltestbase.hxx>
|
|
|
|
#include <bordertest.hxx>
|
|
|
|
|
2012-02-11 17:06:42 +01:00
|
|
|
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
|
|
|
|
|
2012-05-09 15:25:44 +02:00
|
|
|
class Test : public SwModelTestBase
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
void testFdo45553();
|
|
|
|
void testN192129();
|
2012-02-13 21:54:18 +01:00
|
|
|
void testFdo45543();
|
2012-02-18 23:05:52 +01:00
|
|
|
void testN695479();
|
2012-02-22 17:53:03 +01:00
|
|
|
void testFdo42465();
|
2012-02-27 11:19:38 +01:00
|
|
|
void testFdo45187();
|
2012-03-01 11:38:47 +01:00
|
|
|
void testFdo46662();
|
2012-03-12 20:43:42 +01:00
|
|
|
void testN750757();
|
2012-03-13 10:16:27 +01:00
|
|
|
void testFdo45563();
|
2012-03-16 14:23:36 +01:00
|
|
|
void testFdo43965();
|
2012-03-19 10:45:28 +01:00
|
|
|
void testN751020();
|
2012-03-23 12:47:41 +01:00
|
|
|
void testFdo47326();
|
2012-03-24 13:04:54 +01:00
|
|
|
void testFdo47036();
|
2012-03-24 17:14:12 +01:00
|
|
|
void testFdo46955();
|
2012-03-30 10:44:09 +02:00
|
|
|
void testFdo45394();
|
2012-04-02 14:10:39 +02:00
|
|
|
void testFdo48104();
|
2012-04-03 15:07:06 +02:00
|
|
|
void testFdo47107();
|
2012-04-03 16:49:41 +02:00
|
|
|
void testFdo45182();
|
2012-04-11 09:45:53 +02:00
|
|
|
void testFdo44176();
|
2012-04-15 14:39:27 +02:00
|
|
|
void testFdo39053();
|
2012-04-20 12:42:23 +02:00
|
|
|
void testFdo48356();
|
2012-04-21 11:25:18 +02:00
|
|
|
void testFdo48023();
|
2012-04-21 12:53:22 +02:00
|
|
|
void testFdo48876();
|
2012-04-25 11:21:06 +02:00
|
|
|
void testFdo48193();
|
2012-04-21 23:01:09 +03:00
|
|
|
void testFdo44211();
|
2012-04-25 17:51:45 +02:00
|
|
|
void testFdo48037();
|
2012-05-02 17:50:55 +02:00
|
|
|
void testFdo47764();
|
2012-05-07 09:50:02 +02:00
|
|
|
void testFdo38786();
|
2012-05-09 10:21:30 +02:00
|
|
|
void testN757651();
|
2012-05-09 11:30:13 +02:00
|
|
|
void testFdo49501();
|
2012-05-09 16:07:12 +02:00
|
|
|
void testFdo49271();
|
2012-05-10 10:35:47 +02:00
|
|
|
void testFdo49692();
|
2012-05-11 14:45:59 +02:00
|
|
|
void testFdo45190();
|
2012-06-01 16:30:06 +02:00
|
|
|
void testFdo50539();
|
2012-06-06 12:58:07 +02:00
|
|
|
void testFdo50665();
|
2012-06-11 17:55:21 +02:00
|
|
|
void testFdo49659();
|
2012-06-22 18:55:15 +02:00
|
|
|
void testFdo46966();
|
2012-07-18 22:47:03 +02:00
|
|
|
void testFdo52066();
|
2013-02-25 09:45:52 +01:00
|
|
|
void testFdo48033_53594();
|
2012-07-27 17:40:39 +02:00
|
|
|
void testFdo36089();
|
2012-08-01 21:03:58 +02:00
|
|
|
void testFdo49892();
|
2012-08-10 17:48:57 +02:00
|
|
|
void testFdo48446();
|
2012-08-13 12:23:05 +02:00
|
|
|
void testFdo47495();
|
2012-07-28 14:01:04 +02:00
|
|
|
void testAllGapsWord();
|
2012-08-28 11:21:50 +02:00
|
|
|
void testFdo52052();
|
2012-09-19 15:45:12 +02:00
|
|
|
void testInk();
|
2012-09-21 11:58:02 +02:00
|
|
|
void testFdo52389();
|
2013-03-27 12:09:32 +01:00
|
|
|
void testFdo49655_62805();
|
2012-09-28 17:45:21 +02:00
|
|
|
void testFdo52475();
|
2012-10-11 16:48:55 +02:00
|
|
|
void testFdo55493();
|
2012-10-17 10:09:57 +02:00
|
|
|
void testCopyPastePageStyle();
|
2013-01-15 09:58:48 +01:00
|
|
|
void testCopyPasteFootnote();
|
2012-10-17 11:17:14 +02:00
|
|
|
void testShptxtPard();
|
2012-10-17 16:12:15 +02:00
|
|
|
void testDoDhgt();
|
2012-10-18 09:09:03 +02:00
|
|
|
void testDplinehollow();
|
2012-10-18 13:36:49 +02:00
|
|
|
void testLeftmarginDefault();
|
2012-10-19 12:06:34 +02:00
|
|
|
void testDppolyline();
|
2012-10-30 17:39:31 +01:00
|
|
|
void testFdo56512();
|
2012-11-05 16:35:59 +01:00
|
|
|
void testFdo52989();
|
2012-11-06 10:53:10 +01:00
|
|
|
void testFdo48442();
|
2012-11-13 17:30:18 +01:00
|
|
|
void testFdo55525();
|
2012-11-30 17:15:35 +01:00
|
|
|
void testFdo57708();
|
2012-12-04 10:38:53 +01:00
|
|
|
void testFdo54473();
|
2012-12-08 14:04:16 +01:00
|
|
|
void testFdo49934();
|
2012-12-22 19:35:30 +01:00
|
|
|
void testFdo57886();
|
2012-12-23 14:37:59 +01:00
|
|
|
void testFdo58076();
|
2012-12-24 15:06:15 +01:00
|
|
|
void testFdo57678();
|
2012-12-27 23:37:35 +01:00
|
|
|
void testFdo45183();
|
2012-12-30 22:55:20 +01:00
|
|
|
void testFdo54612();
|
2013-01-09 15:29:29 +01:00
|
|
|
void testFdo58933();
|
2013-01-14 17:26:35 +01:00
|
|
|
void testFdo44053();
|
2013-02-01 11:20:52 +01:00
|
|
|
void testFdo48440();
|
2013-02-05 20:46:19 +01:00
|
|
|
void testFdo58646line();
|
2013-02-02 15:29:24 +01:00
|
|
|
void testFdo58646();
|
2013-02-03 14:37:38 +01:00
|
|
|
void testFdo59419();
|
2013-02-05 18:16:12 +01:00
|
|
|
void testFdo58076_2();
|
2013-02-08 12:34:55 +01:00
|
|
|
void testFdo59953();
|
2013-03-01 17:38:03 +01:00
|
|
|
void testFdo59638();
|
2013-03-06 16:23:22 +01:00
|
|
|
void testFdo60722();
|
2013-03-18 12:40:46 +01:00
|
|
|
void testFdo61909();
|
2013-03-22 11:08:12 +01:00
|
|
|
void testFdo62288();
|
2013-03-28 12:19:23 +01:00
|
|
|
void testFdo37716();
|
2013-04-03 17:28:42 +02:00
|
|
|
void testFdo51916();
|
2013-04-15 20:37:52 +02:00
|
|
|
void testFdo61193();
|
2013-04-18 14:42:22 +02:00
|
|
|
void testFdo63023();
|
2013-05-11 18:03:57 +02:00
|
|
|
void testFdo42109();
|
2013-05-15 09:59:18 +02:00
|
|
|
void testFdo62977();
|
2013-05-21 14:56:45 +02:00
|
|
|
void testN818997();
|
2013-05-27 10:44:01 +02:00
|
|
|
void testFdo64671();
|
2013-05-28 21:34:37 +02:00
|
|
|
void testPageBackground();
|
2013-06-04 12:21:11 +02:00
|
|
|
void testFdo62044();
|
2013-06-15 19:05:50 +02:00
|
|
|
void testPoshPosv();
|
2013-06-16 01:21:20 +02:00
|
|
|
void testTextframeTable();
|
2012-02-11 17:06:42 +01:00
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
CPPUNIT_TEST_SUITE(Test);
|
2012-02-11 17:06:42 +01:00
|
|
|
#if !defined(MACOSX) && !defined(WNT)
|
2012-10-21 14:46:21 +02:00
|
|
|
CPPUNIT_TEST(run);
|
2012-02-11 17:06:42 +01:00
|
|
|
#endif
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
private:
|
2012-10-21 14:46:21 +02:00
|
|
|
void run();
|
2013-01-15 11:12:55 +01:00
|
|
|
/// Copy&paste helper.
|
|
|
|
void paste(OUString aFilename, uno::Reference<text::XTextRange> xTextRange = uno::Reference<text::XTextRange>())
|
|
|
|
{
|
|
|
|
uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
|
|
|
|
uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW);
|
|
|
|
xImporter->setTargetDocument(mxComponent);
|
|
|
|
uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2);
|
|
|
|
aDescriptor[0].Name = "InputStream";
|
|
|
|
SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, STREAM_WRITE);
|
|
|
|
uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream));
|
|
|
|
aDescriptor[0].Value <<= xStream;
|
|
|
|
aDescriptor[1].Name = "IsNewDoc";
|
|
|
|
aDescriptor[1].Value <<= sal_False;
|
|
|
|
if (xTextRange.is())
|
|
|
|
{
|
|
|
|
aDescriptor[2].Name = "TextInsertModeRange";
|
|
|
|
aDescriptor[2].Value <<= xTextRange;
|
|
|
|
}
|
|
|
|
xFilter->filter(aDescriptor);
|
|
|
|
}
|
|
|
|
|
2012-02-11 17:06:42 +01:00
|
|
|
};
|
|
|
|
|
2012-10-21 14:46:21 +02:00
|
|
|
void Test::run()
|
|
|
|
{
|
|
|
|
MethodEntry<Test> aMethods[] = {
|
|
|
|
{"fdo45553.rtf", &Test::testFdo45553},
|
|
|
|
{"n192129.rtf", &Test::testN192129},
|
|
|
|
{"fdo45543.rtf", &Test::testFdo45543},
|
|
|
|
{"n695479.rtf", &Test::testN695479},
|
|
|
|
{"fdo42465.rtf", &Test::testFdo42465},
|
|
|
|
{"fdo45187.rtf", &Test::testFdo45187},
|
|
|
|
{"fdo46662.rtf", &Test::testFdo46662},
|
|
|
|
{"n750757.rtf", &Test::testN750757},
|
|
|
|
{"fdo45563.rtf", &Test::testFdo45563},
|
|
|
|
{"fdo43965.rtf", &Test::testFdo43965},
|
|
|
|
{"n751020.rtf", &Test::testN751020},
|
|
|
|
{"fdo47326.rtf", &Test::testFdo47326},
|
|
|
|
{"fdo47036.rtf", &Test::testFdo47036},
|
|
|
|
{"fdo46955.rtf", &Test::testFdo46955},
|
|
|
|
{"fdo45394.rtf", &Test::testFdo45394},
|
|
|
|
{"fdo48104.rtf", &Test::testFdo48104},
|
|
|
|
{"fdo47107.rtf", &Test::testFdo47107},
|
|
|
|
{"fdo45182.rtf", &Test::testFdo45182},
|
|
|
|
{"fdo44176.rtf", &Test::testFdo44176},
|
|
|
|
{"fdo39053.rtf", &Test::testFdo39053},
|
|
|
|
{"fdo48356.rtf", &Test::testFdo48356},
|
|
|
|
{"fdo48023.rtf", &Test::testFdo48023},
|
|
|
|
{"fdo48876.rtf", &Test::testFdo48876},
|
|
|
|
{"fdo48193.rtf", &Test::testFdo48193},
|
|
|
|
{"fdo44211.rtf", &Test::testFdo44211},
|
|
|
|
{"fdo48037.rtf", &Test::testFdo48037},
|
|
|
|
{"fdo47764.rtf", &Test::testFdo47764},
|
|
|
|
{"fdo38786.rtf", &Test::testFdo38786},
|
|
|
|
{"n757651.rtf", &Test::testN757651},
|
|
|
|
{"fdo49501.rtf", &Test::testFdo49501},
|
|
|
|
{"fdo49271.rtf", &Test::testFdo49271},
|
|
|
|
{"fdo49692.rtf", &Test::testFdo49692},
|
|
|
|
{"fdo45190.rtf", &Test::testFdo45190},
|
|
|
|
{"fdo50539.rtf", &Test::testFdo50539},
|
|
|
|
{"fdo50665.rtf", &Test::testFdo50665},
|
|
|
|
{"fdo49659.rtf", &Test::testFdo49659},
|
|
|
|
{"fdo46966.rtf", &Test::testFdo46966},
|
|
|
|
{"fdo52066.rtf", &Test::testFdo52066},
|
2013-02-25 09:45:52 +01:00
|
|
|
{"fdo48033.rtf", &Test::testFdo48033_53594},
|
|
|
|
{"fdo53594.rtf", &Test::testFdo48033_53594},
|
2012-10-21 14:46:21 +02:00
|
|
|
{"fdo36089.rtf", &Test::testFdo36089},
|
|
|
|
{"fdo49892.rtf", &Test::testFdo49892},
|
|
|
|
{"fdo48446.rtf", &Test::testFdo48446},
|
|
|
|
{"fdo47495.rtf", &Test::testFdo47495},
|
|
|
|
{"all_gaps_word.rtf", &Test::testAllGapsWord},
|
|
|
|
{"fdo52052.rtf", &Test::testFdo52052},
|
|
|
|
{"ink.rtf", &Test::testInk},
|
|
|
|
{"fdo52389.rtf", &Test::testFdo52389},
|
2013-03-27 12:09:32 +01:00
|
|
|
{"fdo49655.rtf", &Test::testFdo49655_62805},
|
|
|
|
{"fdo62805.rtf", &Test::testFdo49655_62805},
|
2012-10-21 14:46:21 +02:00
|
|
|
{"fdo52475.rtf", &Test::testFdo52475},
|
|
|
|
{"fdo55493.rtf", &Test::testFdo55493},
|
|
|
|
{"copypaste-pagestyle.rtf", &Test::testCopyPastePageStyle},
|
2013-01-15 09:58:48 +01:00
|
|
|
{"copypaste-footnote.rtf", &Test::testCopyPasteFootnote},
|
2012-10-21 14:46:21 +02:00
|
|
|
{"shptxt-pard.rtf", &Test::testShptxtPard},
|
|
|
|
{"do-dhgt.rtf", &Test::testDoDhgt},
|
|
|
|
{"dplinehollow.rtf", &Test::testDplinehollow},
|
|
|
|
{"leftmargin-default.rtf", &Test::testLeftmarginDefault},
|
|
|
|
{"dppolyline.rtf", &Test::testDppolyline},
|
2012-10-30 17:39:31 +01:00
|
|
|
{"fdo56512.rtf", &Test::testFdo56512},
|
2012-11-05 16:35:59 +01:00
|
|
|
{"fdo52989.rtf", &Test::testFdo52989},
|
2012-11-06 10:53:10 +01:00
|
|
|
{"fdo48442.rtf", &Test::testFdo48442},
|
2012-11-13 17:30:18 +01:00
|
|
|
{"fdo55525.rtf", &Test::testFdo55525},
|
2012-11-30 17:15:35 +01:00
|
|
|
{"fdo57708.rtf", &Test::testFdo57708},
|
2012-12-04 10:38:53 +01:00
|
|
|
{"fdo54473.rtf", &Test::testFdo54473},
|
2012-12-08 14:04:16 +01:00
|
|
|
{"fdo49934.rtf", &Test::testFdo49934},
|
2012-12-22 19:35:30 +01:00
|
|
|
{"fdo57886.rtf", &Test::testFdo57886},
|
2012-12-23 14:37:59 +01:00
|
|
|
{"fdo58076.rtf", &Test::testFdo58076},
|
2012-12-24 15:06:15 +01:00
|
|
|
{"fdo57678.rtf", &Test::testFdo57678},
|
2012-12-27 23:37:35 +01:00
|
|
|
{"fdo45183.rtf", &Test::testFdo45183},
|
2012-12-30 22:55:20 +01:00
|
|
|
{"fdo54612.rtf", &Test::testFdo54612},
|
2013-01-09 15:29:29 +01:00
|
|
|
{"fdo58933.rtf", &Test::testFdo58933},
|
2013-01-14 17:26:35 +01:00
|
|
|
{"fdo44053.rtf", &Test::testFdo44053},
|
2013-02-01 11:20:52 +01:00
|
|
|
{"fdo48440.rtf", &Test::testFdo48440},
|
2013-02-05 20:46:19 +01:00
|
|
|
{"fdo58646line.rtf", &Test::testFdo58646line},
|
2013-02-02 15:29:24 +01:00
|
|
|
{"fdo58646.rtf", &Test::testFdo58646},
|
2013-02-03 14:37:38 +01:00
|
|
|
{"fdo59419.rtf", &Test::testFdo59419},
|
2013-02-05 18:16:12 +01:00
|
|
|
{"fdo58076-2.rtf", &Test::testFdo58076_2},
|
2013-02-08 12:34:55 +01:00
|
|
|
{"fdo59953.rtf", &Test::testFdo59953},
|
2013-03-01 17:38:03 +01:00
|
|
|
{"fdo59638.rtf", &Test::testFdo59638},
|
2013-03-06 16:23:22 +01:00
|
|
|
{"fdo60722.rtf", &Test::testFdo60722},
|
2013-03-18 12:40:46 +01:00
|
|
|
{"fdo61909.rtf", &Test::testFdo61909},
|
2013-03-22 11:08:12 +01:00
|
|
|
{"fdo62288.rtf", &Test::testFdo62288},
|
2013-03-28 12:19:23 +01:00
|
|
|
{"fdo37716.rtf", &Test::testFdo37716},
|
2013-04-03 17:28:42 +02:00
|
|
|
{"fdo51916.rtf", &Test::testFdo51916},
|
2013-04-15 20:37:52 +02:00
|
|
|
{"hello.rtf", &Test::testFdo61193},
|
2013-04-18 14:42:22 +02:00
|
|
|
{"fdo63023.rtf", &Test::testFdo63023},
|
2013-05-11 18:03:57 +02:00
|
|
|
{"fdo42109.rtf", &Test::testFdo42109},
|
2013-05-15 09:59:18 +02:00
|
|
|
{"fdo62977.rtf", &Test::testFdo62977},
|
2013-05-21 14:56:45 +02:00
|
|
|
{"n818997.rtf", &Test::testN818997},
|
2013-05-27 10:44:01 +02:00
|
|
|
{"fdo64671.rtf", &Test::testFdo64671},
|
2013-05-28 21:34:37 +02:00
|
|
|
{"page-background.rtf", &Test::testPageBackground},
|
2013-06-04 12:21:11 +02:00
|
|
|
{"fdo62044.rtf", &Test::testFdo62044},
|
2013-06-15 19:05:50 +02:00
|
|
|
{"posh-posv.rtf", &Test::testPoshPosv},
|
2013-06-16 01:21:20 +02:00
|
|
|
{"textframe-table.rtf", &Test::testTextframeTable},
|
2012-10-21 14:46:21 +02:00
|
|
|
};
|
2012-12-21 22:07:47 +01:00
|
|
|
header();
|
2012-10-21 14:46:21 +02:00
|
|
|
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
|
|
|
|
{
|
|
|
|
MethodEntry<Test>& rEntry = aMethods[i];
|
|
|
|
AllSettings aSavedSettings(Application::GetSettings());
|
|
|
|
if (OString(rEntry.pName) == "fdo48023.rtf")
|
|
|
|
{
|
|
|
|
AllSettings aSettings(aSavedSettings);
|
2012-11-22 12:26:52 +01:00
|
|
|
aSettings.SetLanguageTag(LanguageTag("ru"));
|
2012-10-21 14:46:21 +02:00
|
|
|
Application::SetSettings(aSettings);
|
|
|
|
}
|
|
|
|
else if (OString(rEntry.pName) == "fdo44211.rtf")
|
|
|
|
{
|
|
|
|
AllSettings aSettings(aSavedSettings);
|
2012-11-22 12:26:52 +01:00
|
|
|
aSettings.SetLanguageTag(LanguageTag("lt"));
|
2012-10-21 14:46:21 +02:00
|
|
|
Application::SetSettings(aSettings);
|
|
|
|
}
|
2012-12-21 22:07:47 +01:00
|
|
|
load("/sw/qa/extras/rtfimport/data/", rEntry.pName);
|
2012-10-21 14:46:21 +02:00
|
|
|
if (OString(rEntry.pName) == "fdo48023.rtf" || OString(rEntry.pName) == "fdo44211.rtf")
|
|
|
|
Application::SetSettings(aSavedSettings);
|
|
|
|
(this->*rEntry.pMethod)();
|
2012-12-21 22:07:47 +01:00
|
|
|
finish();
|
2012-10-21 14:46:21 +02:00
|
|
|
}
|
2012-02-11 17:06:42 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45553()
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
while (xRangeEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
OUString aStr = xRange->getString();
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( aStr == "space-before" )
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(120)), getProperty<sal_Int32>(xRange, "ParaTopMargin"));
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aStr == "space-after" )
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(240)), getProperty<sal_Int32>(xRange, "ParaBottomMargin"));
|
2012-02-11 17:06:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN192129()
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
// We expect that the result will be 16x16px.
|
|
|
|
Size aExpectedSize(16, 16);
|
|
|
|
MapMode aMap(MAP_100TH_MM);
|
|
|
|
aExpectedSize = Application::GetDefaultDevice()->PixelToLogic( aExpectedSize, aMap );
|
|
|
|
|
|
|
|
uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
awt::Size aActualSize(xShape->getSize());
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45543()
|
2012-02-13 21:54:18 +01:00
|
|
|
{
|
2012-02-22 17:53:03 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(5, getLength());
|
2012-02-13 21:54:18 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN695479()
|
2012-02-18 23:05:52 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
|
|
|
|
// Negative ABSH should mean fixed size.
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xPropertySet, "SizeType"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(300)), getProperty<sal_Int32>(xPropertySet, "Height"));
|
2012-02-18 23:05:52 +01:00
|
|
|
|
2012-02-21 18:25:37 +01:00
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
bool bFrameFound = false, bDrawFound = false;
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
2012-02-18 23:05:52 +01:00
|
|
|
{
|
2012-02-21 18:25:37 +01:00
|
|
|
uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(i), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
|
2012-02-21 18:25:37 +01:00
|
|
|
{
|
|
|
|
// Both frames should be anchored to the first paragraph.
|
|
|
|
bFrameFound = true;
|
|
|
|
uno::Reference<text::XTextContent> xTextContent(xServiceInfo, uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("plain"), xText->getString());
|
2012-02-22 13:05:37 +01:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
// Additonally, the frist frame should have double border at the bottom.
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::DOUBLE, getProperty<table::BorderLine2>(xPropertySet, "BottomBorder").LineStyle);
|
2012-02-21 18:25:37 +01:00
|
|
|
}
|
2012-05-02 15:01:05 +02:00
|
|
|
else if (xServiceInfo->supportsService("com.sun.star.drawing.LineShape"))
|
2012-02-21 18:25:37 +01:00
|
|
|
{
|
|
|
|
// The older "drawing objects" syntax should be recognized.
|
|
|
|
bDrawFound = true;
|
|
|
|
xPropertySet.set(xServiceInfo, uno::UNO_QUERY);
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xPropertySet, "HoriOrientRelation"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xPropertySet, "VertOrientRelation"));
|
2012-02-21 18:25:37 +01:00
|
|
|
}
|
2012-02-18 23:05:52 +01:00
|
|
|
}
|
2012-02-21 18:25:37 +01:00
|
|
|
CPPUNIT_ASSERT(bFrameFound);
|
|
|
|
CPPUNIT_ASSERT(bDrawFound);
|
2012-02-18 23:05:52 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo42465()
|
2012-02-22 17:53:03 +01:00
|
|
|
{
|
|
|
|
CPPUNIT_ASSERT_EQUAL(3, getLength());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45187()
|
2012-02-27 11:19:38 +01:00
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
// There should be two shapes.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
|
2013-04-10 11:55:22 +02:00
|
|
|
|
2012-02-27 11:19:38 +01:00
|
|
|
// They should be anchored to different paragraphs.
|
2013-04-10 11:55:22 +02:00
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xAnchor0 = uno::Reference<text::XTextContent>(xDraws->getByIndex(0), uno::UNO_QUERY)->getAnchor();
|
|
|
|
uno::Reference<text::XTextRange> xAnchor1 = uno::Reference<text::XTextContent>(xDraws->getByIndex(1), uno::UNO_QUERY)->getAnchor();
|
|
|
|
// Was 0 ("starts at the same position"), should be 1 ("starts before")
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1));
|
2012-02-27 11:19:38 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo46662()
|
2012-03-01 11:38:47 +01:00
|
|
|
{
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
|
2012-03-01 11:38:47 +01:00
|
|
|
uno::Sequence<beans::PropertyValue> aProps;
|
2012-05-02 15:01:05 +02:00
|
|
|
xLevels->getByIndex(1) >>= aProps; // 2nd level
|
2012-03-01 11:38:47 +01:00
|
|
|
|
|
|
|
for (int i = 0; i < aProps.getLength(); ++i)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = aProps[i];
|
|
|
|
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( rProp.Name == "ParentNumbering" )
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), rProp.Value.get<sal_Int16>());
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( rProp.Name == "Suffix" )
|
2012-09-28 18:05:28 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength());
|
2012-03-01 11:38:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN750757()
|
2012-03-12 20:43:42 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
|
2012-09-30 15:04:29 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Bool(false), getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Bool(true), getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin"));
|
2012-03-12 20:43:42 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45563()
|
2012-03-13 10:16:27 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
int i = 0;
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
xParaEnum->nextElement();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
CPPUNIT_ASSERT_EQUAL(4, i);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo43965()
|
2012-03-16 14:23:36 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
|
|
|
|
// First paragraph: the parameter of \up was ignored
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
2012-09-30 15:04:29 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(36), getProperty<sal_Int32>(xPropertySet, "CharEscapement"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xPropertySet, "CharEscapementHeight"));
|
2012-03-16 14:23:36 +01:00
|
|
|
|
|
|
|
// Second paragraph: Word vs Writer border default problem
|
2012-09-30 15:04:29 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<table::BorderLine2>(xParaEnum->nextElement(), "TopBorder").LineWidth);
|
2012-03-16 14:23:36 +01:00
|
|
|
|
|
|
|
// Finally, make sure that we have two pages
|
2012-04-02 14:24:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
2012-03-16 14:23:36 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN751020()
|
2012-03-19 10:45:28 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
|
2012-09-30 15:04:29 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin"));
|
2012-03-19 10:45:28 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo47326()
|
2012-03-23 12:47:41 +01:00
|
|
|
{
|
|
|
|
// This was 15 only, as \super buffered text, then the contents of it got lost.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(19, getLength());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo47036()
|
2012-03-24 13:04:54 +01:00
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
int nAtCharacter = 0;
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
|
|
|
{
|
2012-09-30 15:04:29 +02:00
|
|
|
if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AT_CHARACTER)
|
2012-03-24 13:04:54 +01:00
|
|
|
nAtCharacter++;
|
|
|
|
}
|
|
|
|
// The image at the document start was ignored.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, nAtCharacter);
|
2012-03-24 14:55:09 +01:00
|
|
|
|
|
|
|
// There should be 2 textboxes, not 4
|
|
|
|
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
2012-03-24 13:04:54 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo46955()
|
2012-03-24 17:14:12 +01:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
while (xRangeEnum->hasMoreElements())
|
2012-09-30 15:04:29 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(xRangeEnum->nextElement(), "CharCaseMap"));
|
2012-03-24 17:14:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45394()
|
2012-03-30 10:44:09 +02:00
|
|
|
{
|
2012-11-26 07:38:27 +01:00
|
|
|
uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
|
2012-03-30 10:44:09 +02:00
|
|
|
OUString aActual = xHeaderText->getString();
|
|
|
|
// Encoding in the header was wrong.
|
|
|
|
OUString aExpected("ПК РИК", 11, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
|
|
|
|
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48104()
|
2012-04-02 14:10:39 +02:00
|
|
|
{
|
2012-04-02 14:24:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
2012-04-02 14:10:39 +02:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo47107()
|
2012-04-03 15:07:06 +02:00
|
|
|
{
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
|
2012-04-03 15:07:06 +02:00
|
|
|
// Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
|
|
|
|
xNumberingStyles->getByName("WWNum1");
|
|
|
|
xNumberingStyles->getByName("WWNum2");
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45182()
|
2012-04-03 16:49:41 +02:00
|
|
|
{
|
|
|
|
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
// Encoding in the footnote was wrong.
|
|
|
|
OUString aExpected("živností", 10, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo44176()
|
2012-04-11 09:45:53 +02:00
|
|
|
{
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
|
2012-04-11 09:45:53 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY);
|
2012-11-26 07:38:27 +01:00
|
|
|
uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
|
2012-04-11 09:45:53 +02:00
|
|
|
sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
|
|
|
|
xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop;
|
|
|
|
xDefault->getPropertyValue("TopMargin") >>= nDefaultTop;
|
|
|
|
xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo39053()
|
2012-04-15 14:39:27 +02:00
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
int nAsCharacter = 0;
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
2012-09-30 15:04:29 +02:00
|
|
|
if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AS_CHARACTER)
|
2012-04-15 14:39:27 +02:00
|
|
|
nAsCharacter++;
|
|
|
|
// The image in binary format was ignored.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48356()
|
2012-04-20 12:42:23 +02:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
int i = 0;
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
xParaEnum->nextElement();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
// The document used to be imported as two paragraphs.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, i);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48023()
|
2012-04-21 11:25:18 +02:00
|
|
|
{
|
2012-09-30 15:04:29 +02:00
|
|
|
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
|
2012-04-21 11:25:18 +02:00
|
|
|
|
|
|
|
// Implicit encoding detection based on locale was missing
|
|
|
|
OUString aExpected("Программист", 22, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48876()
|
2012-04-21 12:53:22 +02:00
|
|
|
{
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
|
2012-09-30 15:04:29 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode);
|
2012-04-21 12:53:22 +02:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48193()
|
2012-04-25 11:21:06 +02:00
|
|
|
{
|
|
|
|
CPPUNIT_ASSERT_EQUAL(7, getLength());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo44211()
|
2012-04-21 23:01:09 +03:00
|
|
|
{
|
2012-09-30 15:04:29 +02:00
|
|
|
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
|
2012-04-21 23:01:09 +03:00
|
|
|
|
|
|
|
OUString aExpected("ąčę", 6, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48037()
|
2012-04-25 17:51:45 +02:00
|
|
|
{
|
|
|
|
uno::Reference<util::XNumberFormatsSupplier> xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW);
|
|
|
|
lang::Locale aUSLocale, aFRLocale;
|
|
|
|
aUSLocale.Language = "en";
|
|
|
|
aFRLocale.Language = "fr";
|
|
|
|
sal_Int32 nExpected = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale);
|
|
|
|
|
|
|
|
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
|
|
|
|
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Int32 nActual = 0;
|
|
|
|
xPropertySet->getPropertyValue("NumberFormat") >>= nActual;
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:55 +02:00
|
|
|
void Test::testFdo47764()
|
|
|
|
{
|
|
|
|
// \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
|
2012-09-30 15:11:05 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getParagraph(1), "ParaBackColor"));
|
2012-05-02 17:50:55 +02:00
|
|
|
}
|
|
|
|
|
2012-05-07 09:50:02 +02:00
|
|
|
void Test::testFdo38786()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
|
|
|
|
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
|
|
|
|
// \chpgn was ignored, so exception was thrown
|
|
|
|
xFields->nextElement();
|
|
|
|
}
|
|
|
|
|
2012-05-09 10:21:30 +02:00
|
|
|
void Test::testN757651()
|
|
|
|
{
|
|
|
|
// The bug was that due to buggy layout the text expanded to two pages.
|
|
|
|
if (Application::GetDefaultDevice()->IsFontAvailable(OUString("Times New Roman")))
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
|
|
|
}
|
|
|
|
|
2012-05-09 11:30:13 +02:00
|
|
|
void Test::testFdo49501()
|
|
|
|
{
|
2012-11-26 07:38:27 +01:00
|
|
|
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
|
2012-05-09 11:30:13 +02:00
|
|
|
|
2012-09-30 15:28:47 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStyle, "IsLandscape"));
|
2012-05-09 11:30:13 +02:00
|
|
|
sal_Int32 nExpected(TWIP_TO_MM100(567));
|
2012-09-30 15:28:47 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "LeftMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "RightMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "TopMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "BottomMargin"));
|
2012-05-09 11:30:13 +02:00
|
|
|
}
|
|
|
|
|
2012-05-09 16:07:12 +02:00
|
|
|
void Test::testFdo49271()
|
|
|
|
{
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(25.f, getProperty<float>(getParagraph(2), "CharHeight"));
|
2012-05-09 16:07:12 +02:00
|
|
|
}
|
|
|
|
|
2012-05-10 10:35:47 +02:00
|
|
|
void Test::testFdo49692()
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
|
|
|
|
uno::Sequence<beans::PropertyValue> aProps;
|
|
|
|
xLevels->getByIndex(0) >>= aProps; // 1st level
|
|
|
|
|
|
|
|
for (int i = 0; i < aProps.getLength(); ++i)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = aProps[i];
|
|
|
|
|
|
|
|
if (rProp.Name == "Suffix")
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength());
|
2012-05-10 10:35:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-11 14:45:59 +02:00
|
|
|
void Test::testFdo45190()
|
|
|
|
{
|
|
|
|
// inherited \fi should be reset
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
|
2012-05-11 14:45:59 +02:00
|
|
|
|
|
|
|
// but direct one not
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent"));
|
2012-05-11 14:45:59 +02:00
|
|
|
}
|
|
|
|
|
2012-06-01 16:30:06 +02:00
|
|
|
void Test::testFdo50539()
|
|
|
|
{
|
|
|
|
// \chcbpat with zero argument should mean the auto (-1) color, not a default color (black)
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor"));
|
2012-06-01 16:30:06 +02:00
|
|
|
}
|
|
|
|
|
2012-06-06 12:58:07 +02:00
|
|
|
void Test::testFdo50665()
|
|
|
|
{
|
|
|
|
// Access the second run, which is a textfield
|
2012-09-30 15:50:53 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY);
|
2012-06-06 12:58:07 +02:00
|
|
|
// This used to be the default, as character properties were ignored.
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), getProperty<OUString>(xRun, "CharFontName"));
|
2012-06-06 12:58:07 +02:00
|
|
|
}
|
|
|
|
|
2012-06-11 17:55:21 +02:00
|
|
|
void Test::testFdo49659()
|
|
|
|
{
|
|
|
|
// Both tables were ignored: 1) was in the header, 2) was ignored due to missing empty par at the end of the doc
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
|
|
|
|
|
|
|
// The graphic was also empty
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
2012-09-30 15:50:53 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xGraphic(getProperty< uno::Reference<beans::XPropertySet> >(xDraws->getByIndex(0), "Graphic"), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType"));
|
2012-06-11 17:55:21 +02:00
|
|
|
}
|
|
|
|
|
2012-06-22 18:55:15 +02:00
|
|
|
void Test::testFdo46966()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
|
|
|
|
*
|
|
|
|
* xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin
|
|
|
|
*/
|
2012-11-26 07:38:27 +01:00
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
|
2012-09-30 15:50:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
|
2012-06-22 18:55:15 +02:00
|
|
|
}
|
|
|
|
|
2012-07-18 22:47:03 +02:00
|
|
|
void Test::testFdo52066()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The problem was that the height of the shape was too big.
|
|
|
|
*
|
|
|
|
* xray ThisComponent.DrawPage(0).Size.Height
|
|
|
|
*/
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height);
|
|
|
|
}
|
|
|
|
|
2013-02-25 09:45:52 +01:00
|
|
|
void Test::testFdo48033_53594()
|
2012-07-27 21:20:34 +02:00
|
|
|
{
|
|
|
|
/*
|
2013-02-25 09:45:52 +01:00
|
|
|
* The problem was that the picture (48033) or OLE object (53594) was in the first cell,
|
|
|
|
* instead of the second one.
|
2012-07-27 21:20:34 +02:00
|
|
|
*
|
|
|
|
* oTable = ThisComponent.TextTables(0)
|
|
|
|
* oParas = oTable.getCellByName("B1").Text.createEnumeration
|
|
|
|
* oPara = oParas.nextElement
|
|
|
|
* oRuns = oPara.createEnumeration
|
|
|
|
* oRun = oRuns.nextElement
|
|
|
|
* xray oRun.TextPortionType ' Frame, was Text
|
|
|
|
*/
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
|
|
|
|
}
|
|
|
|
|
2012-07-27 17:40:39 +02:00
|
|
|
void Test::testFdo36089()
|
|
|
|
{
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement"));
|
|
|
|
}
|
|
|
|
|
2012-08-01 21:03:58 +02:00
|
|
|
void Test::testFdo49892()
|
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
|
|
|
{
|
|
|
|
OUString aDescription = getProperty<OUString>(xDraws->getByIndex(i), "Description");
|
|
|
|
if (aDescription == "red")
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
|
|
|
|
else if (aDescription == "green")
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
|
|
|
|
else if (aDescription == "blue")
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
|
|
|
|
else if (aDescription == "rect")
|
|
|
|
{
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "HoriOrientRelation"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "VertOrientRelation"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-10 17:48:57 +02:00
|
|
|
void Test::testFdo48446()
|
|
|
|
{
|
|
|
|
OUString aExpected("Имя", 6, RTL_TEXTENCODING_UTF8);
|
|
|
|
getParagraph(1, aExpected);
|
|
|
|
}
|
|
|
|
|
2012-08-13 12:23:05 +02:00
|
|
|
void Test::testFdo47495()
|
|
|
|
{
|
|
|
|
// Used to have 4 paragraphs, as a result the original bugdoc had 2 pages instead of 1.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
|
|
|
|
}
|
|
|
|
|
2012-07-28 14:01:04 +02:00
|
|
|
void Test::testAllGapsWord()
|
|
|
|
{
|
|
|
|
BorderTest borderTest;
|
|
|
|
borderTest.testTheBorders(mxComponent);
|
|
|
|
}
|
|
|
|
|
2012-08-28 11:21:50 +02:00
|
|
|
void Test::testFdo52052()
|
|
|
|
{
|
|
|
|
// Make sure the textframe containing the text "third" appears on the 3rd page.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()"));
|
|
|
|
}
|
|
|
|
|
2012-09-19 15:45:12 +02:00
|
|
|
void Test::testInk()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The problem was that the second segment had wrong command count and wrap type.
|
|
|
|
*
|
|
|
|
* oShape = ThisComponent.DrawPage(0)
|
|
|
|
* oPathPropVec = oShape.CustomShapeGeometry(1).Value
|
|
|
|
* oSegments = oPathPropVec(1).Value
|
|
|
|
* msgbox oSegments(1).Count ' was 0x2000 | 10, should be 10
|
|
|
|
* msgbox oShape.Surround ' was 2, should be 1
|
|
|
|
*/
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xDraws->getByIndex(0), "CustomShapeGeometry");
|
2012-11-16 14:00:10 +00:00
|
|
|
uno::Sequence<beans::PropertyValue> aPathProps;
|
2012-09-19 15:45:12 +02:00
|
|
|
for (int i = 0; i < aProps.getLength(); ++i)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = aProps[i];
|
|
|
|
if (rProp.Name == "Path")
|
2012-11-16 14:00:10 +00:00
|
|
|
rProp.Value >>= aPathProps;
|
2012-09-19 15:45:12 +02:00
|
|
|
}
|
|
|
|
uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
|
2012-11-16 14:00:10 +00:00
|
|
|
for (int i = 0; i < aPathProps.getLength(); ++i)
|
2012-09-19 15:45:12 +02:00
|
|
|
{
|
2012-11-16 14:00:10 +00:00
|
|
|
const beans::PropertyValue& rProp = aPathProps[i];
|
2012-09-19 15:45:12 +02:00
|
|
|
if (rProp.Name == "Segments")
|
|
|
|
rProp.Value >>= aSegments;
|
|
|
|
}
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(10), aSegments[1].Count);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xDraws->getByIndex(0), "Surround"));
|
|
|
|
}
|
|
|
|
|
2012-09-21 11:58:02 +02:00
|
|
|
void Test::testFdo52389()
|
|
|
|
{
|
|
|
|
// The last '!' character at the end of the document was lost
|
|
|
|
CPPUNIT_ASSERT_EQUAL(6, getLength());
|
|
|
|
}
|
|
|
|
|
2013-03-27 12:09:32 +01:00
|
|
|
void Test::testFdo49655_62805()
|
2012-09-24 09:41:02 +01:00
|
|
|
{
|
|
|
|
/*
|
2013-03-27 12:09:32 +01:00
|
|
|
* 49655 :
|
2012-09-24 09:41:02 +01:00
|
|
|
* The problem was that the table was not imported due to the ' ' string in the middle of the table definition.
|
|
|
|
*
|
|
|
|
* xray ThisComponent.TextTables.Count 'was 0
|
2013-03-27 12:09:32 +01:00
|
|
|
*
|
|
|
|
* 62805 :
|
|
|
|
* The problem was that the table was not imported due to the absence of \pard after \row.
|
|
|
|
* The table was instead in a group (the '}' replace the \pard).
|
2012-09-24 09:41:02 +01:00
|
|
|
*/
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
|
|
|
|
}
|
|
|
|
|
2012-09-28 17:45:21 +02:00
|
|
|
void Test::testFdo52475()
|
|
|
|
{
|
|
|
|
// The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor"));
|
|
|
|
}
|
|
|
|
|
2012-10-11 16:48:55 +02:00
|
|
|
void Test::testFdo55493()
|
|
|
|
{
|
|
|
|
// The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
|
|
|
|
}
|
|
|
|
|
2012-10-17 10:09:57 +02:00
|
|
|
void Test::testCopyPastePageStyle()
|
|
|
|
{
|
|
|
|
// The problem was that RTF import during copy&paste did not ignore page styles.
|
|
|
|
// Once we have more copy&paste tests, makes sense to refactor this to some helper method.
|
2013-01-15 11:12:55 +01:00
|
|
|
paste("copypaste-pagestyle-paste.rtf");
|
2012-10-17 10:09:57 +02:00
|
|
|
|
2012-11-26 07:38:27 +01:00
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
|
2012-10-17 10:09:57 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
|
|
|
|
}
|
|
|
|
|
2013-01-15 09:58:48 +01:00
|
|
|
void Test::testCopyPasteFootnote()
|
|
|
|
{
|
|
|
|
// The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote.
|
|
|
|
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
|
2013-01-15 11:12:55 +01:00
|
|
|
paste("copypaste-footnote-paste.rtf", xTextRange);
|
2013-01-15 09:58:48 +01:00
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2013-04-15 20:37:52 +02:00
|
|
|
void Test::testFdo61193()
|
|
|
|
{
|
|
|
|
// Pasting content that contained a footnote caused a crash.
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xEnd = xText->getEnd();
|
|
|
|
paste("fdo61193.rtf", xEnd);
|
|
|
|
}
|
|
|
|
|
2012-10-17 11:17:14 +02:00
|
|
|
void Test::testShptxtPard()
|
|
|
|
{
|
|
|
|
// The problem was that \pard inside \shptxt caused loss of shape text
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XText> xText(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
|
|
|
|
}
|
|
|
|
|
2012-10-17 16:12:15 +02:00
|
|
|
void Test::testDoDhgt()
|
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
|
|
|
{
|
|
|
|
sal_Int32 nFillColor = getProperty<sal_Int32>(xDraws->getByIndex(i), "FillColor");
|
|
|
|
if (nFillColor == 0xc0504d) // red
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
|
|
|
|
else if (nFillColor == 0x9bbb59) // green
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
|
|
|
|
else if (nFillColor == 0x4f81bd) // blue
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-18 09:09:03 +02:00
|
|
|
void Test::testDplinehollow()
|
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xPropertySet, "LineStyle"));
|
|
|
|
}
|
|
|
|
|
2012-10-18 13:36:49 +02:00
|
|
|
void Test::testLeftmarginDefault()
|
|
|
|
{
|
|
|
|
// The default left/right margin was incorrect when the top margin was set to zero.
|
2012-11-26 07:38:27 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin"));
|
2012-10-18 13:36:49 +02:00
|
|
|
}
|
|
|
|
|
2012-10-19 12:06:34 +02:00
|
|
|
void Test::testDppolyline()
|
|
|
|
{
|
|
|
|
// This was completely ignored, for now, just make sure we have all 4 lines.
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
|
|
|
|
}
|
|
|
|
|
2012-10-30 17:39:31 +01:00
|
|
|
void Test::testFdo56512()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
OUString aExpected("עוסק מורשה ", 20, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-11-05 16:35:59 +01:00
|
|
|
void Test::testFdo52989()
|
|
|
|
{
|
|
|
|
// Same as n#192129, but for JPEG files.
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape->getSize().Width);
|
|
|
|
}
|
|
|
|
|
2012-11-06 10:53:10 +01:00
|
|
|
void Test::testFdo48442()
|
|
|
|
{
|
|
|
|
// The problem was that \pvmrg is the default in RTF, but not in Writer.
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME
|
|
|
|
}
|
|
|
|
|
2012-11-13 17:30:18 +01:00
|
|
|
void Test::testFdo55525()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
// Negative left margin was ~missing, -191
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getProperty<sal_Int32>(xTable, "LeftMargin"));
|
|
|
|
// Cell width of A1 was 3332 (e.g. not set, 30% percent of total width)
|
|
|
|
uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
|
2013-03-28 16:47:28 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
|
2012-11-13 17:30:18 +01:00
|
|
|
}
|
|
|
|
|
2012-11-30 17:15:35 +01:00
|
|
|
void Test::testFdo57708()
|
|
|
|
{
|
|
|
|
// There were two issues: the doc was of 2 pages and the picture was missing.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
// Two objects: a picture and a textframe.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
|
|
|
|
}
|
|
|
|
|
2012-12-04 10:38:53 +01:00
|
|
|
void Test::testFdo54473()
|
|
|
|
{
|
|
|
|
// The problem was that character styles were not imported due to a typo.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
|
|
|
|
}
|
|
|
|
|
2012-12-08 14:04:16 +01:00
|
|
|
void Test::testFdo49934()
|
|
|
|
{
|
|
|
|
// Column break without columns defined should be a page break, but it was just ignored.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
|
|
|
}
|
|
|
|
|
2012-12-22 19:35:30 +01:00
|
|
|
void Test::testFdo57886()
|
|
|
|
{
|
|
|
|
// Was 'int from <?> to <?> <?>'.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), getFormula(getRun(getParagraph(1), 1)));
|
|
|
|
}
|
|
|
|
|
2012-12-23 14:37:59 +01:00
|
|
|
void Test::testFdo58076()
|
|
|
|
{
|
|
|
|
// An additional section was created, so the default page style didn't have the custom margins.
|
|
|
|
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2251), getProperty<sal_Int32>(xStyle, "LeftMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1752), getProperty<sal_Int32>(xStyle, "RightMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "TopMargin"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "BottomMargin"));
|
|
|
|
}
|
|
|
|
|
2012-12-24 15:06:15 +01:00
|
|
|
void Test::testFdo57678()
|
|
|
|
{
|
|
|
|
// Paragraphs of the two tables were not converted to tables.
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
|
|
|
}
|
|
|
|
|
2012-12-27 23:37:35 +01:00
|
|
|
void Test::testFdo45183()
|
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
// Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xDraws->getByIndex(0), "Surround"));
|
|
|
|
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
// Was 247, resulting in a table having width almost zero and height of 10+ pages.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(16237), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
|
|
|
|
}
|
|
|
|
|
2012-12-30 22:55:20 +01:00
|
|
|
void Test::testFdo54612()
|
|
|
|
{
|
|
|
|
// \dpptx without a \dppolycount caused a crash.
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount());
|
|
|
|
}
|
|
|
|
|
2013-01-09 15:29:29 +01:00
|
|
|
void Test::testFdo58933()
|
|
|
|
{
|
|
|
|
// The problem was that the table had an additional cell in its first line.
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
// This was 4.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
|
|
|
|
}
|
|
|
|
|
2013-01-14 17:26:35 +01:00
|
|
|
void Test::testFdo44053()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
|
|
|
|
// The with of the table's A1 and A2 cell should equal.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position,
|
|
|
|
getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
|
|
|
|
}
|
|
|
|
|
2013-02-01 11:20:52 +01:00
|
|
|
void Test::testFdo48440()
|
|
|
|
{
|
|
|
|
// Page break was ignored.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
|
|
|
}
|
|
|
|
|
2013-02-05 20:46:19 +01:00
|
|
|
void Test::testFdo58646line()
|
|
|
|
{
|
|
|
|
// \line symbol was ignored
|
|
|
|
getParagraph(1, "foo\nbar");
|
|
|
|
}
|
|
|
|
|
2013-02-02 15:29:24 +01:00
|
|
|
void Test::testFdo58646()
|
|
|
|
{
|
|
|
|
// Page break was ignored inside a continous section, on title page.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
|
|
|
}
|
|
|
|
|
2013-02-03 14:37:38 +01:00
|
|
|
void Test::testFdo59419()
|
|
|
|
{
|
|
|
|
// Junk to be ignored broke import of the table.
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
|
|
|
|
}
|
|
|
|
|
2013-02-05 18:16:12 +01:00
|
|
|
void Test::testFdo58076_2()
|
|
|
|
{
|
|
|
|
// Position of the picture wasn't correct.
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(8345)), getProperty<sal_Int32>(xDraws->getByIndex(0), "HoriOrientPosition"));
|
|
|
|
}
|
|
|
|
|
2013-02-08 12:34:55 +01:00
|
|
|
void Test::testFdo59953()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
// Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width)
|
|
|
|
uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
|
2013-03-28 16:47:28 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
|
2013-02-08 12:34:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-01 17:38:03 +01:00
|
|
|
void Test::testFdo59638()
|
|
|
|
{
|
|
|
|
// The problem was that w:lvlOverride inside w:num was ignores by dmapper.
|
|
|
|
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
|
|
|
|
uno::Sequence<beans::PropertyValue> aProps;
|
|
|
|
xLevels->getByIndex(0) >>= aProps; // 1st level
|
|
|
|
|
|
|
|
for (int i = 0; i < aProps.getLength(); ++i)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = aProps[i];
|
|
|
|
|
|
|
|
if (rProp.Name == "BulletChar")
|
|
|
|
{
|
|
|
|
// Was '*', should be 'o'.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8), rProp.Value.get<OUString>());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CPPUNIT_FAIL("no BulletChar property");
|
|
|
|
}
|
|
|
|
|
2013-03-06 16:23:22 +01:00
|
|
|
void Test::testFdo60722()
|
|
|
|
{
|
|
|
|
// The problem was that the larger shape was over the smaller one, and not the other way around.
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<beans::XPropertySet> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xShape, "ZOrder"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("larger"), getProperty<OUString>(xShape, "Description"));
|
|
|
|
|
|
|
|
xShape.set(xDraws->getByIndex(1), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("smaller"), getProperty<OUString>(xShape, "Description"));
|
|
|
|
|
|
|
|
// Color of the line was blue, and it had zero width.
|
|
|
|
xShape.set(xDraws->getByIndex(2), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<sal_uInt32>(xShape, "LineWidth"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "LineColor"));
|
|
|
|
}
|
|
|
|
|
2013-03-18 12:40:46 +01:00
|
|
|
void Test::testFdo61909()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
|
2013-03-18 14:49:02 +01:00
|
|
|
// Was the Writer default font.
|
2013-03-18 12:40:46 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, "CharFontName"));
|
2013-03-18 14:49:02 +01:00
|
|
|
// Was 0x008000.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor"));
|
2013-03-18 12:40:46 +01:00
|
|
|
}
|
|
|
|
|
2013-03-22 11:08:12 +01:00
|
|
|
void Test::testFdo62288()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
// Margins were inherited from the previous cell, even there was a \pard there.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin"));
|
|
|
|
}
|
|
|
|
|
2013-03-28 12:19:23 +01:00
|
|
|
void Test::testFdo37716()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
|
|
|
|
// \nowrap got ignored, so Surround was text::WrapTextMode_PARALLEL
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround"));
|
|
|
|
}
|
|
|
|
|
2013-04-03 17:28:42 +02:00
|
|
|
void Test::testFdo51916()
|
|
|
|
{
|
|
|
|
// Complex nested table caused a crash.
|
|
|
|
}
|
|
|
|
|
2013-04-18 14:42:22 +02:00
|
|
|
void Test::testFdo63023()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
|
|
|
|
// Back color was black (0) in the header, due to missing color table in the substream.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFF99), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xHeaderText), 1), "CharBackColor"));
|
|
|
|
}
|
|
|
|
|
2013-05-11 18:03:57 +02:00
|
|
|
void Test::testFdo42109()
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
|
|
|
|
// Make sure the page number is imported as a field in the B1 cell.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType"));
|
|
|
|
}
|
|
|
|
|
2013-05-15 09:59:18 +02:00
|
|
|
void Test::testFdo62977()
|
|
|
|
{
|
|
|
|
// The middle character was imported as '?' instead of the proper unicode value.
|
|
|
|
getRun(getParagraph(1), 1, OUString("\xE5\xB9\xB4\xEF\xBC\x94\xE6\x9C\x88", 9, RTL_TEXTENCODING_UTF8));
|
|
|
|
}
|
|
|
|
|
2013-05-21 14:56:45 +02:00
|
|
|
void Test::testN818997()
|
|
|
|
{
|
|
|
|
// \page was ignored between two \shp tokens.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
|
|
|
}
|
|
|
|
|
2013-05-27 10:44:01 +02:00
|
|
|
void Test::testFdo64671()
|
|
|
|
{
|
|
|
|
// Additional '}' was inserted before the special character.
|
|
|
|
getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
|
|
|
|
}
|
|
|
|
|
2013-05-28 21:34:37 +02:00
|
|
|
void Test::testPageBackground()
|
|
|
|
{
|
|
|
|
// The problem was that \background was ignored.
|
|
|
|
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
|
|
|
|
}
|
|
|
|
|
2013-06-04 12:21:11 +02:00
|
|
|
void Test::testFdo62044()
|
|
|
|
{
|
|
|
|
// The problem was that RTF import during copy&paste did not ignore existing paragraph styles.
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xEnd = xText->getEnd();
|
|
|
|
paste("fdo62044-paste.rtf", xEnd);
|
|
|
|
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
|
|
|
|
}
|
|
|
|
|
2013-06-15 19:05:50 +02:00
|
|
|
void Test::testPoshPosv()
|
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "HoriOrient"));
|
|
|
|
CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrient"));
|
|
|
|
}
|
|
|
|
|
2013-06-16 01:21:20 +02:00
|
|
|
void Test::testTextframeTable()
|
|
|
|
{
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XText> xText = xTextRange->getText();
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("First para."), getParagraphOfText(1, xText)->getString());
|
|
|
|
uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2, xText), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("A"), uno::Reference<text::XTextRange>(xTable->getCellByName("A1"), uno::UNO_QUERY)->getString());
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("B"), uno::Reference<text::XTextRange>(xTable->getCellByName("B1"), uno::UNO_QUERY)->getString());
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("Last para."), getParagraphOfText(3, xText)->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
2012-02-11 17:06:42 +01:00
|
|
|
|
|
|
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|