[Libreoffice-commits] .: sw/qa
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Feb 22 08:59:59 PST 2012
sw/qa/extras/rtftok/data/fdo42465.rtf | 4 ++
sw/qa/extras/rtftok/rtftok.cxx | 47 ++++++++++++++++++++++------------
2 files changed, 35 insertions(+), 16 deletions(-)
New commits:
commit 938ddf379004d9696a005ed612994576e2d7cca0
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Feb 22 17:53:03 2012 +0100
testcase for fdo#42465
diff --git a/sw/qa/extras/rtftok/data/fdo42465.rtf b/sw/qa/extras/rtftok/data/fdo42465.rtf
new file mode 100644
index 0000000..06c29d4
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo42465.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+{\langfe1038\dbch\af14\afs24\alang1025\rtlch \ltrch\loch\fs24\lang1038\loch\f7
+k\uc2 \u243\'c3\'b3d\uc1 }
+\par }
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index eb64e0a..92c3229 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -58,6 +58,7 @@ public:
void testN192129();
void testFdo45543();
void testN695479();
+ void testFdo42465();
CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT)
@@ -65,11 +66,15 @@ public:
CPPUNIT_TEST(testN192129);
CPPUNIT_TEST(testFdo45543);
CPPUNIT_TEST(testN695479);
+ CPPUNIT_TEST(testFdo42465);
#endif
CPPUNIT_TEST_SUITE_END();
private:
+ /// Load an RTF file and make the document available via mxComponent.
void load(const OUString& rURL);
+ /// Get the length of the whole document.
+ int getLength();
uno::Reference<lang::XComponent> mxComponent;
};
@@ -78,6 +83,25 @@ void RtfModelTest::load(const OUString& rFilename)
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/rtftok/data/") + rFilename);
}
+int RtfModelTest::getLength()
+{
+ 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();
+ OUStringBuffer aBuf;
+ 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);
+ aBuf.append(xRange->getString());
+ }
+ }
+ return aBuf.getLength();
+}
+
void RtfModelTest::setUp()
{
test::BootstrapFixture::setUp();
@@ -150,22 +174,7 @@ void RtfModelTest::testN192129()
void RtfModelTest::testFdo45543()
{
load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo45543.rtf")));
-
- 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();
- OUStringBuffer aBuf;
- 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);
- aBuf.append(xRange->getString());
- }
- }
- CPPUNIT_ASSERT_EQUAL((sal_Int32)5, aBuf.getLength());
+ CPPUNIT_ASSERT_EQUAL(5, getLength());
}
void RtfModelTest::testN695479()
@@ -229,6 +238,12 @@ void RtfModelTest::testN695479()
CPPUNIT_ASSERT(bDrawFound);
}
+void RtfModelTest::testFdo42465()
+{
+ load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo42465.rtf")));
+ CPPUNIT_ASSERT_EQUAL(3, getLength());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list