/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
{ const std::vector<char>& rBuf = *itBuf;
CPPUNIT_ASSERT_EQUAL(size_t(1048576), rBuf.size()); // 1 MB each. for (char check : rBuf) if (c != check)
CPPUNIT_ASSERT_MESSAGE("stream does not contain expected data", false);
}
}
// TODO : This test currently doesn't fail even when you set // UseBufferedStream to false. Look into this and replace it with a better // test that actually fails when the aforementioned flag is set to false. void PackageTest::testThreadedStreams()
{ class Worker : public comphelper::ThreadTask
{
uno::Reference<io::XInputStream> mxStrm;
std::vector<char>& mrBuf;
uno::Sequence<sal_Int8> aBytes; //Read chunks of increasing size
nReadSize += 1024;
while (nSize > 0)
{
sal_Int32 nBytesRead = xStrm->readBytes(aBytes, nReadSize); const sal_Int8* p = aBytes.getArray(); const sal_Int8* pEnd = p + nBytesRead;
std::copy(p, pEnd, std::back_inserter(*itBuf));
nSize -= nBytesRead;
}
}
verifyStreams( aTestBuffers );
}
void PackageTest::testZip64()
{ // This small zip file have 2 files (content.xml, styles.xml) that have // Zip64 Extended Information Extra Field in both // "Local file header" and "Central directory file header", // and have ZIP64 format "Data descriptor".
OUString aURL2 = m_directories.getURLFromSrc(u"/package/qa/cppunit/data/export64.zip");
// Without Zip64 support, it would crash here
uno::Reference<packages::zip::XZipFileAccess2> xZip2(
xSvcMgr->createInstanceWithArgumentsAndContext(
u"com.sun.star.packages.zip.ZipFileAccess"_ustr, aArgs2, xCxt),
uno::UNO_QUERY);
// Check if the styles.xml seems to be right
uno::Reference<io::XInputStream> xStrm;
xNA->getByName(u"styles.xml"_ustr) >>= xStrm;
CPPUNIT_ASSERT(xStrm.is()); // Filesize check
sal_Int32 nSize = xStrm->available();
CPPUNIT_ASSERT_EQUAL(sal_Int32(1112), nSize);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.