diff options
author | David Tardon <dtardon@redhat.com> | 2014-05-24 14:21:21 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-05-26 18:49:04 +0200 |
commit | 48c9d7ac7ccdad27067efe0d168e96ff48372631 (patch) | |
tree | 82b808b8c597046ed507aa6e2badd21090090190 /writerperfect/qa | |
parent | 2013d184f1cf5928fa4a919d1521c1ae7b053796 (diff) |
rebase all import libs
Change-Id: I9e1fc613816c943f4fb1033185e34e3acf317f1d
Diffstat (limited to 'writerperfect/qa')
-rw-r--r-- | writerperfect/qa/unit/WPXSvStreamTest.cxx | 135 | ||||
-rw-r--r-- | writerperfect/qa/unit/WpftImpressFilterTest.cxx | 2 | ||||
-rw-r--r-- | writerperfect/qa/unit/WpftWriterFilterTest.cxx | 4 |
3 files changed, 73 insertions, 68 deletions
diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index 1d28ec814d30..d75f201f1395 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -34,6 +34,11 @@ namespace uno = com::sun::star::uno; using boost::shared_ptr; +using librevenge::RVNGInputStream; +using librevenge::RVNG_SEEK_CUR; +using librevenge::RVNG_SEEK_END; +using librevenge::RVNG_SEEK_SET; + using std::equal; using writerperfect::WPXSvInputStream; @@ -64,21 +69,21 @@ static const char aText[] = "hello world"; static const char aOLEFile[] = "/writerperfect/qa/unit/data/fdo40686-1.doc"; static const char aZipFile[] = "/writerperfect/qa/unit/data/test.odt"; -shared_ptr<WPXInputStream> lcl_createStream() +shared_ptr<RVNGInputStream> lcl_createStream() { using comphelper::SequenceInputStream; const css::uno::Sequence<sal_Int8> aData(reinterpret_cast<const sal_Int8*>(aText), sizeof aText); const uno::Reference<io::XInputStream> xInputStream(new SequenceInputStream(aData)); - shared_ptr<WPXInputStream> pInputStream; + shared_ptr<RVNGInputStream> pInputStream; if (xInputStream.is()) pInputStream.reset(new WPXSvInputStream(xInputStream)); return pInputStream; } -const shared_ptr<WPXInputStream> lcl_createStreamForURL(const rtl::OUString &rURL) +const shared_ptr<RVNGInputStream> lcl_createStreamForURL(const rtl::OUString &rURL) { using uno::Reference; using uno::UNO_QUERY_THROW; @@ -89,13 +94,13 @@ const shared_ptr<WPXInputStream> lcl_createStreamForURL(const rtl::OUString &rUR UNO_QUERY_THROW); const Reference<io::XInputStream> xInputStream(xFileAccess->openFileRead(rURL), UNO_QUERY_THROW); - const shared_ptr<WPXInputStream> pInput(new WPXSvInputStream(xInputStream)); + const shared_ptr<RVNGInputStream> pInput(new WPXSvInputStream(xInputStream)); return pInput; } void WPXSvStreamTest::testRead() { - const shared_ptr<WPXInputStream> pInput(lcl_createStream()); + const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); const unsigned long nLen = sizeof aText; unsigned long nReadBytes = 0; @@ -107,199 +112,199 @@ void WPXSvStreamTest::testRead() pData = pInput->read(1UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(1UL, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); pText += nReadBytes; pData = pInput->read(2UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(2UL, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); pText += nReadBytes; pData = pInput->read(3UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(3UL, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); pText += nReadBytes; assert(nLen > 6); pData = pInput->read(nLen - 6, nReadBytes); CPPUNIT_ASSERT_EQUAL(nLen - 6, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // reading everything at once - pInput->seek(0, WPX_SEEK_SET); + pInput->seek(0, RVNG_SEEK_SET); pText = pTextOrig; pData = pInput->read(nLen, nReadBytes); CPPUNIT_ASSERT_EQUAL(nLen, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // trying to read too much - pInput->seek(0, WPX_SEEK_SET); + pInput->seek(0, RVNG_SEEK_SET); pText = pTextOrig; pData = pInput->read(nLen + 1, nReadBytes); CPPUNIT_ASSERT_EQUAL(nLen, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // trying to read nothing - pInput->seek(0, WPX_SEEK_SET); + pInput->seek(0, RVNG_SEEK_SET); pText = pTextOrig; pData = pInput->read(0UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(0UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); CPPUNIT_ASSERT_EQUAL(pData, static_cast<const unsigned char*>(0)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); } void WPXSvStreamTest::testSeekSet() { - const shared_ptr<WPXInputStream> pInput(lcl_createStream()); + const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); const long nLen = sizeof aText; // check initial state CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); // valid seeks - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(1L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(nLen, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(nLen, RVNG_SEEK_SET)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // go back to the beginning - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // invalid seeks - CPPUNIT_ASSERT(0 != pInput->seek(-1, WPX_SEEK_SET)); + CPPUNIT_ASSERT(0 != pInput->seek(-1, RVNG_SEEK_SET)); // Okay, this is not defined. But it is what the WPXSvInputStream // does ATM and it is reasonable. CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, WPX_SEEK_SET)); + CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, RVNG_SEEK_SET)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); } void WPXSvStreamTest::testSeekCur() { - const shared_ptr<WPXInputStream> pInput(lcl_createStream()); + const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); const long nLen = sizeof aText; // check initial state - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // valid seeks - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_CUR)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(1L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); // go back to the beginning - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // invalid seeks - CPPUNIT_ASSERT(0 != pInput->seek(-1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT(0 != pInput->seek(-1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); } void WPXSvStreamTest::testSeekEnd() { - const shared_ptr<WPXInputStream> pInput(lcl_createStream()); + const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); const long nLen = sizeof aText; // check initial state - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // valid seeks - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_END)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_END)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, WPX_SEEK_END)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, RVNG_SEEK_END)); CPPUNIT_ASSERT((nLen - 1) == pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-nLen, WPX_SEEK_END)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-nLen, RVNG_SEEK_END)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); // go back to the beginning - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // invalid seeks - CPPUNIT_ASSERT(0 != pInput->seek(1, WPX_SEEK_END)); + CPPUNIT_ASSERT(0 != pInput->seek(1, RVNG_SEEK_END)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); - CPPUNIT_ASSERT(0 != pInput->seek(-nLen - 1, WPX_SEEK_END)); + CPPUNIT_ASSERT(0 != pInput->seek(-nLen - 1, RVNG_SEEK_END)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); } void WPXSvStreamTest::testStructured() { // OLE2 { - const shared_ptr<WPXInputStream> pInput(lcl_createStreamForURL(getURLFromSrc(aOLEFile))); + const shared_ptr<RVNGInputStream> pInput(lcl_createStreamForURL(getURLFromSrc(aOLEFile))); assert(bool(pInput)); - CPPUNIT_ASSERT(pInput->isOLEStream()); - shared_ptr<WPXInputStream> pSubStream(pInput->getDocumentOLEStream("WordDocument")); + CPPUNIT_ASSERT(pInput->isStructured()); + shared_ptr<RVNGInputStream> pSubStream(pInput->getSubStreamByName("WordDocument")); CPPUNIT_ASSERT(bool(pSubStream)); - pSubStream.reset(pInput->getDocumentOLEStream("foo")); + pSubStream.reset(pInput->getSubStreamByName("foo")); CPPUNIT_ASSERT(!pSubStream); } // Zip { - const shared_ptr<WPXInputStream> pInput(lcl_createStreamForURL(getURLFromSrc(aZipFile))); + const shared_ptr<RVNGInputStream> pInput(lcl_createStreamForURL(getURLFromSrc(aZipFile))); assert(bool(pInput)); - CPPUNIT_ASSERT(pInput->isOLEStream()); - shared_ptr<WPXInputStream> pSubStream(pInput->getDocumentOLEStream("content.xml")); + CPPUNIT_ASSERT(pInput->isStructured()); + shared_ptr<RVNGInputStream> pSubStream(pInput->getSubStreamByName("content.xml")); CPPUNIT_ASSERT(bool(pSubStream)); - pSubStream.reset(pInput->getDocumentOLEStream("foo")); + pSubStream.reset(pInput->getSubStreamByName("foo")); CPPUNIT_ASSERT(!pSubStream); } // not structured { - const shared_ptr<WPXInputStream> pInput(lcl_createStream()); + const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); - CPPUNIT_ASSERT(!pInput->isOLEStream()); - CPPUNIT_ASSERT(0 == pInput->getDocumentOLEStream("foo")); + CPPUNIT_ASSERT(!pInput->isStructured()); + CPPUNIT_ASSERT(0 == pInput->getSubStreamByName("foo")); } } diff --git a/writerperfect/qa/unit/WpftImpressFilterTest.cxx b/writerperfect/qa/unit/WpftImpressFilterTest.cxx index 2f349fa8134b..4286f8a8e214 100644 --- a/writerperfect/qa/unit/WpftImpressFilterTest.cxx +++ b/writerperfect/qa/unit/WpftImpressFilterTest.cxx @@ -31,7 +31,7 @@ WpftImpressFilterTest::WpftImpressFilterTest() void WpftImpressFilterTest::test() { - doTest("org.libreoffice.comp.Impress.KeynoteImportFilter", "/writerperfect/qa/unit/data/libetonyek/"); + // doTest("org.libreoffice.comp.Impress.KeynoteImportFilter", "/writerperfect/qa/unit/data/libetonyek/"); } CPPUNIT_TEST_SUITE_REGISTRATION(WpftImpressFilterTest); diff --git a/writerperfect/qa/unit/WpftWriterFilterTest.cxx b/writerperfect/qa/unit/WpftWriterFilterTest.cxx index 284c5f5578a1..2afc4e73aae8 100644 --- a/writerperfect/qa/unit/WpftWriterFilterTest.cxx +++ b/writerperfect/qa/unit/WpftWriterFilterTest.cxx @@ -32,9 +32,9 @@ WpftWriterFilterTest::WpftWriterFilterTest() void WpftWriterFilterTest::test() { doTest("com.sun.star.comp.Writer.AbiWordImportFilter", "/writerperfect/qa/unit/data/libabw/"); - doTest("org.libreoffice.comp.Writer.EBookImportFilter", "/writerperfect/qa/unit/data/libe-book/"); + // doTest("org.libreoffice.comp.Writer.EBookImportFilter", "/writerperfect/qa/unit/data/libe-book/"); doTest("com.sun.star.comp.Writer.MSWorksImportFilter", "/writerperfect/qa/unit/data/libwps/"); - doTest("com.sun.star.comp.Writer.MWAWImportFilter", "/writerperfect/qa/unit/data/libmwaw/"); + // doTest("com.sun.star.comp.Writer.MWAWImportFilter", "/writerperfect/qa/unit/data/libmwaw/"); doTest("com.sun.star.comp.Writer.WordPerfectImportFilter", "/writerperfect/qa/unit/data/libwpd/"); } |