summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-02-22 17:53:03 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-02-22 17:59:42 +0100
commit938ddf379004d9696a005ed612994576e2d7cca0 (patch)
tree63e8019afa4fe0e16a755139d0c411893f977cc8
parent0915f1b3d77afa694a2ca692aec307846827da99 (diff)
testcase for fdo#42465
-rw-r--r--sw/qa/extras/rtftok/data/fdo42465.rtf4
-rw-r--r--sw/qa/extras/rtftok/rtftok.cxx47
2 files changed, 35 insertions, 16 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo42465.rtf b/sw/qa/extras/rtftok/data/fdo42465.rtf
new file mode 100644
index 000000000000..06c29d42022c
--- /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 eb64e0ae9737..92c32294e794 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();