/* * 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempStorage, "Stream1", "MediaType1", true, pBytes1 ) ) returnfalse;
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "EncrStream1", "MediaType2", true, pBytes1, pPass1 ) ) returnfalse;
// open a new substorage
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1",
ElementModes.WRITE ); if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream1", "MediaType3", true, pBytes1 ) ) returnfalse;
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "SubEncrStream1", "MediaType4", true, pBytes1, pPass1 ) ) returnfalse;
// open a new substorage in the existing substorage
XStorage xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage, "SubSubStorage1",
ElementModes.WRITE ); if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubSubStorage, "SubSubStream1", "MediaType5", true, pBytes1 ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubSubStorage, "MediaType6", false,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType7", false,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType8", true,
ElementModes.WRITE ) ) returnfalse;
// check the copying with renaming
if ( !TestCopyWithRenaming( xTempStorage, xTempSubStorage, xTempSubSubStorage ) ) returnfalse;
// test the copying with renaming if ( !TestCopyWithRenaming( xTempStorage, xTempSubStorage, xTempSubSubStorage ) ) returnfalse;
// the storage is based on the temporary stream so it can be left undisposed, since it does not lock // any resource, later the garbage collector will release the object and it must die by refcount
returntrue;
} catch( Exception e )
{
m_aTestHelper.Error( "Exception: " + e ); returnfalse;
}
}
// open a new substorage
XStorage xTempSubStorage2 = m_aTestHelper.openSubStorage( xTempStorage2, "SubStorage1_target",
ElementModes.WRITE ); if ( xTempSubStorage2 == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// open a new substorage in the existing substorage
XStorage xTempSubSubStorage2 = m_aTestHelper.openSubStorage( xTempSubStorage2, "SubSubStorage1_target",
ElementModes.WRITE ); if ( xTempSubSubStorage2 == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// make a copy with renaming on lowerest level if ( !m_aTestHelper.copyElementTo( xTempSubSubStorage, "SubSubStream1", xTempSubSubStorage2, "SubSubStream1_renamed" ) ) returnfalse;
// make a copy with renaming on the next level
if ( !m_aTestHelper.copyElementTo( xTempSubStorage, "SubStream1", xTempSubStorage2, "SubStream1_renamed" ) ) returnfalse;
if ( !m_aTestHelper.copyElementTo( xTempSubStorage, "SubEncrStream1", xTempSubStorage2, "SubEncrStream1_renamed" ) ) returnfalse;
if ( !m_aTestHelper.copyElementTo( xTempSubStorage, "SubSubStorage1", xTempSubStorage2, "SubSubStorage1_renamed" ) ) returnfalse;
// make a copy with renaming of subelements of the root storage
if ( !m_aTestHelper.copyElementTo( xTempStorage, "Stream1", xTempStorage2, "Stream1_renamed" ) ) returnfalse;
if ( !m_aTestHelper.copyElementTo( xTempStorage, "EncrStream1", xTempStorage2, "EncrStream1_renamed" ) ) returnfalse;
if ( !m_aTestHelper.copyElementTo( xTempStorage, "SubStorage1", xTempStorage2, "SubStorage1_renamed" ) ) returnfalse;
// commit the storages, and check the renaming in all stages
// commit substorage to let the renaming take place if ( !m_aTestHelper.commitStorage( xTempSubSubStorage2 ) ) returnfalse;
// commit substorage to let the renaming take place if ( !m_aTestHelper.commitStorage( xTempSubStorage2 ) ) returnfalse;
// commit the root storage so the contents must be stored now if ( !m_aTestHelper.commitStorage( xTempStorage2 ) ) returnfalse;
// the storage is based on the temporary stream so it can be left undisposed, since it does not lock // any resource, later the garbage collector will release the object and it must die by refcount
returntrue;
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
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.