summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-12-30 17:38:12 +0000
committerMichael Meeks <michael.meeks@collabora.com>2014-12-30 17:49:15 +0000
commit0376706c11458c269d6736e17367ee3f0404c4e9 (patch)
treeff981adec2e77991c5701b46ff121a5c1c2a8da1 /sot
parent5bde87b62028ea9ff0df801eedaf1cc54dda6df5 (diff)
fdo#84229 - add sot storage unit test.
Change-Id: Ic11c397984602bf8a2e292bc901cd7bf71ad555d
Diffstat (limited to 'sot')
-rw-r--r--sot/qa/cppunit/data/pass/fdo84229-1.compoundbin0 -> 14848 bytes
-rw-r--r--sot/qa/cppunit/test_sot.cxx26
2 files changed, 26 insertions, 0 deletions
diff --git a/sot/qa/cppunit/data/pass/fdo84229-1.compound b/sot/qa/cppunit/data/pass/fdo84229-1.compound
new file mode 100644
index 000000000000..46eb4da8fddb
--- /dev/null
+++ b/sot/qa/cppunit/data/pass/fdo84229-1.compound
Binary files differ
diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index c97a86e0b812..92ade70a11a4 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -36,9 +36,11 @@ namespace
unsigned int, unsigned int, unsigned int) SAL_OVERRIDE;
void test();
+ void testSize();
CPPUNIT_TEST_SUITE(SotTest);
CPPUNIT_TEST(test);
+ CPPUNIT_TEST(testSize);
CPPUNIT_TEST_SUITE_END();
};
@@ -120,6 +122,30 @@ namespace
OUString());
}
+ void SotTest::testSize()
+ {
+ OUString aURL(getURLFromSrc("/sot/qa/cppunit/data/pass/fdo84229-1.compound"));
+ SvFileStream aStream(aURL, STREAM_READ);
+ SotStorageRef xObjStor = new SotStorage(aStream);
+ CPPUNIT_ASSERT_MESSAGE("sot storage failed to open",
+ xObjStor.Is() && !xObjStor->GetError());
+ SotStorageStreamRef xStream = xObjStor->OpenSotStream("Book");
+ CPPUNIT_ASSERT_MESSAGE("stream failed to open",
+ xStream.Is() && !xObjStor->GetError());
+ CPPUNIT_ASSERT_MESSAGE("error in opened stream", !xStream->GetError());
+ sal_uLong nPos = xStream->GetSize();
+ CPPUNIT_ASSERT_MESSAGE("odd stream length", nPos == 13312);
+
+ xStream->Seek(STREAM_SEEK_TO_END);
+ CPPUNIT_ASSERT_MESSAGE("error seeking to end", !xStream->GetError());
+ // cf. comment in Pos2Page, not extremely intuitive ...
+ CPPUNIT_ASSERT_MESSAGE("stream not at beginning", xStream->Tell() == xStream->GetSize());
+ xStream->Seek(STREAM_SEEK_TO_BEGIN);
+
+ CPPUNIT_ASSERT_MESSAGE("error seeking to beginning", !xStream->GetError());
+ CPPUNIT_ASSERT_MESSAGE("stream not at beginning", xStream->Tell() == 0);
+ }
+
CPPUNIT_TEST_SUITE_REGISTRATION(SotTest);
}