Kaydet (Commit) f0ed219c authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: move the textframe-table testcase from rtfimport to rtfexport

Change-Id: I7e9d26ec1f47d16e35e24fc4bd9482f5d899e79c
üst 04071016
...@@ -65,6 +65,7 @@ public: ...@@ -65,6 +65,7 @@ public:
void testTextFrameBorders(); void testTextFrameBorders();
void testTextframeGradient(); void testTextframeGradient();
void testRecordChanges(); void testRecordChanges();
void testTextframeTable();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -119,6 +120,7 @@ void Test::run() ...@@ -119,6 +120,7 @@ void Test::run()
{"textframe-borders.rtf", &Test::testTextFrameBorders}, {"textframe-borders.rtf", &Test::testTextFrameBorders},
{"textframe-gradient.rtf", &Test::testTextframeGradient}, {"textframe-gradient.rtf", &Test::testTextframeGradient},
{"record-changes.rtf", &Test::testRecordChanges}, {"record-changes.rtf", &Test::testRecordChanges},
{"textframe-table.rtf", &Test::testTextframeTable},
}; };
// Don't test the first import of these, for some reason those tests fail // Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = { const char* aBlacklist[] = {
...@@ -592,6 +594,19 @@ void Test::testRecordChanges() ...@@ -592,6 +594,19 @@ void Test::testRecordChanges()
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(mxComponent, "RecordChanges")); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(mxComponent, "RecordChanges"));
} }
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());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -142,7 +142,6 @@ public: ...@@ -142,7 +142,6 @@ public:
void testPageBackground(); void testPageBackground();
void testFdo62044(); void testFdo62044();
void testPoshPosv(); void testPoshPosv();
void testTextframeTable();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -272,7 +271,6 @@ void Test::run() ...@@ -272,7 +271,6 @@ void Test::run()
{"page-background.rtf", &Test::testPageBackground}, {"page-background.rtf", &Test::testPageBackground},
{"fdo62044.rtf", &Test::testFdo62044}, {"fdo62044.rtf", &Test::testFdo62044},
{"posh-posv.rtf", &Test::testPoshPosv}, {"posh-posv.rtf", &Test::testPoshPosv},
{"textframe-table.rtf", &Test::testTextframeTable},
}; };
header(); header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
...@@ -1286,19 +1284,6 @@ void Test::testPoshPosv() ...@@ -1286,19 +1284,6 @@ void Test::testPoshPosv()
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xDraws->getByIndex(0), "FrameIsAutomaticHeight")); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xDraws->getByIndex(0), "FrameIsAutomaticHeight"));
} }
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());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment