/** verifies that aliases for inner queries work as expected
*/
@Test publicvoid checkTableFormattingPersistence() throws java.lang.Exception
{ // create, load, and connect a DB doc
CRMDatabase database = new CRMDatabase( getMSF(), true );
// save close the database document
database.saveAndClose();
// load a copy of the document // normally, it should be sufficient to load the same doc. However, there might be objects in the Java VM // which are not yet freed, and which effectively hold the document alive. More precise: The document (|doc|) // is certainly disposed, but other objects might hold a reference to one of the many other components // around the database document, the data source, the connection, etc. As long as those objects are // not cleaned up, the "database model impl" - the structure holding all document data - will // stay alive, and subsequent requests to load the doc will just reuse it, without really loading it.
docURL = copyToTempFile( docURL );
loadDocument( docURL );
database = new CRMDatabase( getMSF(), docURL );
// display the table, again
tableViewController = UnoRuntime.queryInterface( XFormController.class,
database.loadSubComponent( DatabaseObject.TABLE, "customers" ) );
tableControlModel = UnoRuntime.queryInterface( XPropertySet.class,
tableViewController.getCurrentControl().getModel() );
// verify the properties
assertEquals( "wrong font name", "Andale Sans UI", tableControlModel.getPropertyValue( "FontName" ) );
assertEquals( "wrong font height", 20, ((Float)tableControlModel.getPropertyValue( "FontHeight" )).floatValue(), 0 );
assertEquals( "wrong font slant", FontSlant.ITALIC, tableControlModel.getPropertyValue( "FontSlant" ) );
// close the doc
database.saveAndClose();
}
/** *checkswhetherquerycolumnsusethesettingsoftheunderlyingtablecolumn,iftheydonot(yet)haveown *settings
*/
@Test publicvoid checkTransparentQueryColumnSettings() throws java.lang.Exception
{ // create, load, and connect a DB doc
CRMDatabase database = new CRMDatabase( getMSF(), true );
// change the formatting of a table column
XPropertySet idColumn = UnoRuntime.queryInterface( XPropertySet.class, tableControlModel.getByName( "ID" ) );
assertTrue( "precondition not met: column already centered",
((Short)idColumn.getPropertyValue( "Align" )).shortValue() != TextAlign.CENTER );
idColumn.setPropertyValue( "Align", TextAlign.CENTER );
// close the table data view
XCloseable closeSubComponent = UnoRuntime.queryInterface( XCloseable.class, tableView.getFrame() );
closeSubComponent.close( true );
// create a query based on that column
database.getDatabase().getDataSource().createQuery( "q_customers", "SELECT * FROM \"customers\"" );
// load this query, and verify the table column settings was propagated to the query column
XFormController queryViewController = UnoRuntime.queryInterface( XFormController.class,
database.loadSubComponent( DatabaseObject.QUERY, "q_customers" ) );
tableControlModel = UnoRuntime.queryInterface( XNameAccess.class,
queryViewController.getCurrentControl().getModel() );
idColumn = UnoRuntime.queryInterface( XPropertySet.class, tableControlModel.getByName( "ID" ) );
assertTrue( "table column alignment was not propagated to the query column",
((Short)idColumn.getPropertyValue( "Align" )).shortValue() == TextAlign.CENTER );
// save close the database document
database.saveAndClose();
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-09-28)
¤
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.