diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-31 10:22:55 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-31 12:31:40 +0200 |
commit | 5beec739f0c790615ed84e35dd513282d7dfa17d (patch) | |
tree | 75903b76ea2ab680de038d97e8527d7b385b71e3 /libreofficekit | |
parent | cc7f66dd53fd6b6c80134aa11fb4c00f95441f7c (diff) |
LOK: add test for getDocumentType.
Change-Id: I264567f73dae9ecd061e09c4413857f793fcac48
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/data/blank_presentation.odp | bin | 0 -> 15630 bytes | |||
-rw-r--r-- | libreofficekit/qa/data/blank_text.odt | bin | 0 -> 8295 bytes | |||
-rw-r--r-- | libreofficekit/qa/unit/tiledrendering.cxx | 30 |
3 files changed, 30 insertions, 0 deletions
diff --git a/libreofficekit/qa/data/blank_presentation.odp b/libreofficekit/qa/data/blank_presentation.odp Binary files differnew file mode 100644 index 000000000000..fd68d9a9b137 --- /dev/null +++ b/libreofficekit/qa/data/blank_presentation.odp diff --git a/libreofficekit/qa/data/blank_text.odt b/libreofficekit/qa/data/blank_text.odt Binary files differnew file mode 100644 index 000000000000..00b92d785acd --- /dev/null +++ b/libreofficekit/qa/data/blank_text.odt diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx index c5446150c8d5..043ffafcd63c 100644 --- a/libreofficekit/qa/unit/tiledrendering.cxx +++ b/libreofficekit/qa/unit/tiledrendering.cxx @@ -48,6 +48,7 @@ public: // components on the one Office instance that we retrieve. void runAllTests(); + void testDocumentTypes( Office* pOffice ); void testImpressSlideNames( Office* pOffice ); void testOverlay( Office* pOffice ); @@ -62,6 +63,7 @@ void TiledRenderingTest::runAllTests() m_sLOPath.c_str() ) ); CPPUNIT_ASSERT( pOffice.get() ); + testDocumentTypes( pOffice.get() ); testImpressSlideNames( pOffice.get() ); testOverlay( pOffice.get() ); } @@ -83,6 +85,34 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, sOutput.Close(); } +LibreOfficeKitDocumentType getDocumentType( Office* pOffice, const string& rPath ) +{ + scoped_ptr< Document> pDocument( pOffice->documentLoad( rPath.c_str() ) ); + CPPUNIT_ASSERT( pDocument.get() ); + return pDocument->getDocumentType(); +} + +void TiledRenderingTest::testDocumentTypes( Office* pOffice ) +{ + const string sTextDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_text.odt"; + const string sTextLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_text.odt#"; + + // FIXME: same comment as below wrt lockfile removal. + remove( sTextLockFile.c_str() ); + + CPPUNIT_ASSERT( getDocumentType( pOffice, sTextDocPath ) == LOK_DOCTYPE_TEXT ); + + const string sPresentationDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_presentation.odp"; + const string sPresentationLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_presentation.odp#"; + + // FIXME: same comment as below wrt lockfile removal. + remove( sPresentationLockFile.c_str() ); + + CPPUNIT_ASSERT( getDocumentType( pOffice, sPresentationDocPath ) == LOK_DOCTYPE_PRESENTATION ); + + // TODO: do this for all supported document types +} + void TiledRenderingTest::testImpressSlideNames( Office* pOffice ) { const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/impress_slidenames.odp"; |