/* * 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 .
*/
/** * implements the {@link DocumentTest} interface on top of a spreadsheet document
*/ publicclass CalcDocumentTest extends DocumentTestBase
{ public CalcDocumentTest( final XMultiServiceFactory i_orb ) throws Exception
{ super( i_orb, DocumentType.CALC );
}
public String getDocumentDescription()
{ return"spreadsheet document";
}
publicvoid initializeDocument() throws com.sun.star.uno.Exception
{ final XCell cellA1 = getCellA1();
cellA1.setValue( INIT_VALUE );
assertEquals( "initializing the cell value didn't work", cellA1.getValue(), INIT_VALUE, 0 );
XCellRange range = UnoRuntime.queryInterface( XCellRange.class,
((SpreadsheetDocument)m_document).getSheet(0) );
for ( int i=0; i<12; ++i )
{
XCell cell = range.getCellByPosition( 1, i );
cell.setFormula( "" );
}
}
publicvoid doSingleModification() throws com.sun.star.uno.Exception
{ final XCell cellA1 = getCellA1();
assertEquals( "initial cell value not as expected", INIT_VALUE, cellA1.getValue(), 0 );
cellA1.setValue( MODIFIED_VALUE );
assertEquals( "modified cell value not as expected", MODIFIED_VALUE, cellA1.getValue(), 0 );
}
publicvoid verifyInitialDocumentState() throws com.sun.star.uno.Exception
{ final XCell cellA1 = getCellA1();
assertEquals( "cell A1 doesn't have its initial value", INIT_VALUE, cellA1.getValue(), 0 );
XCellRange range = UnoRuntime.queryInterface( XCellRange.class,
((SpreadsheetDocument)m_document).getSheet(0) ); for ( int i=0; i<12; ++i )
{ final XCell cell = range.getCellByPosition( 1, i );
assertEquals( "Cell B" + (i+1) + " not having its initial value (an empty string)", "", cell.getFormula() );
}
}
publicvoid verifySingleModificationDocumentState() throws com.sun.star.uno.Exception
{ final XCell cellA1 = getCellA1();
assertEquals( "cell A1 doesn't have the value which we gave it", MODIFIED_VALUE, cellA1.getValue(), 0 );
}
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.