diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-07-03 11:25:35 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-07-03 13:11:58 +0200 |
commit | 4a32ef9c3f3bcb603e253444b4221cebd227b3d8 (patch) | |
tree | 6d920a79ac09ab41a49edc7bf2bd55808e495fb2 /sdext | |
parent | Check exit code of spawned xpdfimport (diff) | |
download | core-4a32ef9c3f3bcb603e253444b4221cebd227b3d8.tar.gz core-4a32ef9c3f3bcb603e253444b4221cebd227b3d8.zip |
Improve test code
(never call CPPUNIT_ASSERT etc., which work by throwing exceptions, from a dtor)
Change-Id: I293d54eb40c2ad9205d485ccff0ffd2161257142
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/test/tests.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index 8b47c0a6470f..9538c66e91dc 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -82,7 +82,9 @@ namespace m_bImageSeen(false) {} - virtual ~TestSink() + virtual ~TestSink() {} + + void check() { CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "A4 page size (in 100th of points): Width", 79400, m_aPageSize.Width, 0.00000001); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "A4 page size (in 100th of points): Height", 59500, m_aPageSize.Height, 0.0000001 ); @@ -458,16 +460,15 @@ namespace public: void testXPDFParser() { - pdfi::ContentSinkSharedPtr pSink( new TestSink() ); - pdfi::xpdf_ImportFromFile( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), - pSink, - uno::Reference< task::XInteractionHandler >(), - OUString(), - getComponentContext() ); - - // make destruction explicit, a bunch of things are - // checked in the destructor - pSink.reset(); + boost::shared_ptr<TestSink> pSink( new TestSink() ); + CPPUNIT_ASSERT( + pdfi::xpdf_ImportFromFile( + getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), + pSink, + uno::Reference< task::XInteractionHandler >(), + OUString(), + getComponentContext() ) ); + pSink->check(); } void testOdfDrawExport() |