From 26f408cc8be7bf1d51a4617cbd4653fc00a43af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Mon, 8 Sep 2003 12:10:35 +0000 Subject: [PATCH] INTEGRATION: CWS qadev11 (1.2.14); FILE MERGED 2003/09/03 15:30:04 sw 1.2.14.1: #112049# --- .../_toolkit/UnoControlRadioButtonModel.java | 58 +++----- .../_toolkit/UnoControlScrollBarModel.java | 36 +++-- .../mod/_toolkit/UnoControlTimeField.java | 133 ++++++++++-------- 3 files changed, 107 insertions(+), 120 deletions(-) diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java index fda119db3d08..bc23507708c1 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java @@ -2,9 +2,9 @@ * * $RCSfile: UnoControlRadioButtonModel.java,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change:$Date: 2003-05-27 14:07:16 $ + * last change:$Date: 2003-09-08 13:10:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,64 +58,38 @@ * * ************************************************************************/ - package mod._toolkit; -import com.sun.star.text.XTextDocument; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; + import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; -import util.WriterTools; import util.utils; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + + public class UnoControlRadioButtonModel extends TestCase { - - XTextDocument xTextDoc; - - /** - * Creates StarOffice Writer document. - */ - protected void initialize( TestParameters tParam, PrintWriter log ) { - - log.println( "creating a textdocument" ); - xTextDoc = WriterTools.createTextDoc((XMultiServiceFactory)tParam.getMSF()); - } - - /** - * Disposes StarOffice Writer document. - */ - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); - xTextDoc.dispose(); - } - - - public synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - + public synchronized TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { XInterface oObj = null; try { - oObj = (XInterface) ((XMultiServiceFactory)Param.getMSF()).createInstance( - "com.sun.star.awt.UnoControlRadioButtonModel"); + oObj = (XInterface) ( (XMultiServiceFactory) Param.getMSF()) + .createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); } catch (Exception e) { - } + log.println( + "creating a new environment for UnoControlRadioButtonModel object"); - log.println( "creating a new environment for UnoControlRadioButtonModel object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + TestEnvironment tEnv = new TestEnvironment(oObj); tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.RadioButton"); - System.out.println("ImplementationName: "+utils.getImplName(oObj)); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); return tEnv; - } // finish method getTestEnvironment - -} // finish class UnoControlRadioButtonModel - +} // finish class UnoControlRadioButtonModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java index a4a84e675504..3e13deb52cf7 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java @@ -2,9 +2,9 @@ * * $RCSfile: UnoControlScrollBarModel.java,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change:$Date: 2003-05-27 14:07:26 $ + * last change:$Date: 2003-09-08 13:10:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,18 +58,20 @@ * * ************************************************************************/ - package mod._toolkit; -import com.sun.star.uno.XInterface; -import com.sun.star.lang.XMultiServiceFactory; import java.io.PrintWriter; + import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + + /** * Test for object which is represented by service * com.sun.star.awt.UnoControlScrollBarModel.

@@ -95,7 +97,6 @@ import util.utils; * @see ifc.beans._XMultiPropertySet */ public class UnoControlScrollBarModel extends TestCase { - /** * Creating a Testenvironment for the interfaces to be tested. * Creates an instance of the service @@ -106,29 +107,24 @@ public class UnoControlScrollBarModel extends TestCase { * {@link ifc.io._XPersistObject} * */ - public synchronized TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) - throws StatusException { - + public synchronized TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) + throws StatusException { XInterface oObj = null; try { - oObj = (XInterface) ((XMultiServiceFactory)Param.getMSF()).createInstance( - "com.sun.star.awt.UnoControlScrollBarModel"); + oObj = (XInterface) ( (XMultiServiceFactory) Param.getMSF()) + .createInstance("com.sun.star.awt.UnoControlScrollBarModel"); } catch (Exception e) { - } + log.println("creating a new environment for object"); - log.println( "creating a new environment for object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + TestEnvironment tEnv = new TestEnvironment(oObj); tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.ScrollBar"); - System.out.println("ImplementationName: "+utils.getImplName(oObj)); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); return tEnv; - } // finish method getTestEnvironment - -} - +} \ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java index c45f67cbce67..238e6be77124 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java @@ -2,9 +2,9 @@ * * $RCSfile: UnoControlTimeField.java,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change:$Date: 2003-05-27 14:07:34 $ + * last change:$Date: 2003-09-08 13:10:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,25 +58,10 @@ * * ************************************************************************/ - package mod._toolkit; -import com.sun.star.awt.XControl; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.awt.XControlModel; -import com.sun.star.awt.XDevice; -import com.sun.star.awt.XGraphics; -import com.sun.star.awt.XTextComponent; -import com.sun.star.awt.XToolkit; -import com.sun.star.awt.XWindow; -import com.sun.star.awt.XWindowPeer; -import com.sun.star.drawing.XControlShape; -import com.sun.star.drawing.XShape; -import com.sun.star.text.XTextDocument; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.view.XControlAccess; import java.io.PrintWriter; + import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -86,47 +71,77 @@ import util.SOfficeFactory; import util.WriterTools; import util.utils; -public class UnoControlTimeField extends TestCase { +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XCloseable; +import com.sun.star.view.XControlAccess; + +public class UnoControlTimeField extends TestCase { XTextDocument xTextDoc; - protected void initialize ( TestParameters Param, PrintWriter log) { - SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF() ); + protected void initialize(TestParameters Param, PrintWriter log) { + SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) Param.getMSF()); try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } catch (com.sun.star.uno.Exception e) { // Some exception occures.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); + e.printStackTrace(log); + throw new StatusException("Couldn't create document", e); } } - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); - xTextDoc.dispose(); + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + try { + XCloseable closer = (XCloseable) UnoRuntime.queryInterface( + XCloseable.class, xTextDoc); + closer.close(true); + } catch (com.sun.star.util.CloseVetoException e) { + log.println("couldn't close document"); + } catch (com.sun.star.lang.DisposedException e) { + log.println("couldn't close document"); + } } - public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) - throws StatusException { + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; XDevice aDevice = null; XGraphics aGraphic = null; XControl aControl = null; + //Insert a ControlShape and get the ControlModel - XControlShape aShape = FormTools.createUnoControlShape( - xTextDoc,3000,4500,15000,10000,"TimeField","UnoControlTimeField"); + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "TimeField", + "UnoControlTimeField"); WriterTools.getDrawPage(xTextDoc).add((XShape) aShape); XControlModel the_Model = aShape.getControl(); - XControlShape aShape2 = FormTools.createControlShape( - xTextDoc,3000,4500,5000,10000,"TextField"); + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); WriterTools.getDrawPage(xTextDoc).add((XShape) aShape2); @@ -134,7 +149,8 @@ public class UnoControlTimeField extends TestCase { //Try to query XControlAccess XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface( - XControlAccess.class,xTextDoc.getCurrentController()); + XControlAccess.class, + xTextDoc.getCurrentController()); //get the TimeFieldControl for the needed Object relations try { @@ -142,45 +158,46 @@ public class UnoControlTimeField extends TestCase { aControl = the_access.getControl(the_Model2); the_win = the_access.getControl(the_Model).getPeer(); the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200,200); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); aGraphic = aDevice.createGraphics(); } catch (Exception e) { log.println("Couldn't get TimeFieldControl"); e.printStackTrace(log); - throw new StatusException("Couldn't get TimeFieldControl", e ); + throw new StatusException("Couldn't get TimeFieldControl", e); } - log.println( "creating a new environment for UnoControlTimeField object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + log.println( + "creating a new environment for UnoControlTimeField object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + //Adding ObjRelation for XView - tEnv.addObjRelation("GRAPHICS",aGraphic); + tEnv.addObjRelation("GRAPHICS", aGraphic); + //Adding ObjRelation for XControl - tEnv.addObjRelation("CONTEXT",xTextDoc); - tEnv.addObjRelation("WINPEER",the_win); - tEnv.addObjRelation("TOOLKIT",the_kit); - tEnv.addObjRelation("MODEL",the_Model); + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); - XWindow forObjRel = (XWindow) - UnoRuntime.queryInterface(XWindow.class,aControl); + XWindow forObjRel = (XWindow) UnoRuntime.queryInterface(XWindow.class, + aControl); - tEnv.addObjRelation("XWindow.AnotherWindow",forObjRel); - tEnv.addObjRelation("XWindow.ControlShape",aShape); + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); // Adding relation for XTextListener ifc.awt._XTextListener.TestTextListener listener = - new ifc.awt._XTextListener.TestTextListener() ; - XTextComponent textComp = (XTextComponent) - UnoRuntime.queryInterface(XTextComponent.class, oObj); + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = (XTextComponent) UnoRuntime.queryInterface( + XTextComponent.class, oObj); textComp.addTextListener(listener); tEnv.addObjRelation("TestTextListener", listener); - log.println("ImplementationName: "+utils.getImplName(oObj)); + log.println("ImplementationName: " + utils.getImplName(oObj)); return tEnv; } // finish method getTestEnvironment - -} // finish class UnoControlTimeField - - +} // finish class UnoControlTimeField