diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-10-11 18:49:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-15 07:56:42 +0200 |
commit | 9ec8bf8f22fe74884185492ef2576ce79b41e4f1 (patch) | |
tree | 0b162c71c51a55125a2ce6055632d4f96180f431 /sw/qa | |
parent | a84e3df74eecc8778e3d5be5dd80ad4ddb511edf (diff) |
add SvStream::TellEnd
and simplify callsites to use it instead of the current
"seek to end, find pos, seek back to original pos"
pattern
Change-Id: Ib5828868f73c341891efc759af8bd4695ae2f33c
Reviewed-on: https://gerrit.libreoffice.org/61738
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/htmlexport/htmlexport.cxx | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 861054868ec1..1c5effbac61b 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -356,9 +356,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, "reqif-p.xhtml") { SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aExpected("<reqif-xhtml:div><reqif-xhtml:p>aaa<reqif-xhtml:br/>\nbbb" "</reqif-xhtml:p>" SAL_NEWLINE_STRING); @@ -444,9 +442,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml") // "type" attribute was missing for the inner <object> element. SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1); } @@ -470,9 +466,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfPngImg, "reqif-png-img.xhtml") // subset. SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:object") != -1); @@ -487,9 +481,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfJpgImg, "reqif-jpg-img.xhtml") { SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); // This was image/jpeg, JPG was not converted to PNG in ReqIF mode. CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1); @@ -514,9 +506,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable2, "reqif-table2.odt") { SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); // This failed, <reqif-xhtml:td width="..."> was written. CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:td>") != -1); @@ -526,9 +516,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfWellFormed, "reqif.odt") { SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); // This failed, <font face="..."> was written. CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:span style=\"font-family:") != -1); @@ -540,9 +528,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfList, "reqif-list.xhtml") { SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); // This failed, <ul> was written. CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:ul>") != -1); @@ -594,9 +580,7 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html") { SvStream* pStream = maTempFile.GetStream(StreamMode::READ); CPPUNIT_ASSERT(pStream); - pStream->Seek(STREAM_SEEK_TO_END); - sal_uInt64 nLength = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 nLength = pStream->TellEnd(); OString aStream(read_uInt8s_ToOString(*pStream, nLength)); // This failed, it was <li/>, i.e. list item was closed before content // started. |