/* * 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 substorage
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1",
ElementModes.WRITE ); if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// open an empty substorage
XStorage xEmptySubStorage = m_aTestHelper.openSubStorage( xTempStorage, "EmptySubStorage1",
ElementModes.WRITE ); if ( xEmptySubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// open an empty substorage
XStorage xEmptySubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage, "EmptySubSubStorage1",
ElementModes.WRITE ); if ( xEmptySubSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
byte pBytes1[] = { 1, 1, 1, 1, 1 };
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType2", true,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xEmptySubStorage, "MediaType3", false,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType4", false,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xEmptySubSubStorage, "MediaType5", false,
ElementModes.WRITE ) ) returnfalse;
// make a copy of substorage
if ( !m_aTestHelper.copyElementTo( xTempStorage, "SubStorage1", xTempStorage, "SubStorage1_copy" ) ) returnfalse;
if ( !m_aTestHelper.copyElementTo( xTempStorage, "EmptySubStorage1", xTempStorage, "EmptySubStorage1_copy" ) ) returnfalse;
// copy all the changed and noncommitted substorages // and dispose them
if ( !m_aTestHelper.commitStorage( xEmptySubSubStorage ) ) returnfalse;
if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
if ( !m_aTestHelper.commitStorage( xEmptySubStorage ) ) returnfalse;
if ( !m_aTestHelper.commitStorage( xTempStorage ) ) returnfalse;
// dispose substorages
if ( !m_aTestHelper.disposeStorage( xEmptySubSubStorage ) ) returnfalse;
if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) ) returnfalse;
if ( !m_aTestHelper.disposeStorage( xEmptySubStorage ) ) returnfalse;
if ( !m_aTestHelper.disposeStorage( xTempStorage ) ) returnfalse;
// reopen the storage in readonly mode and check contents
// the root 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;
}
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 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.