INTEGRATION: CWS qadev11 (1.2.14); FILE MERGED
2003/09/03 15:33:06 sw 1.2.14.1: #112049#
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: OGroupBoxControl.java,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change:$Date: 2003-05-27 12:43:18 $
|
||||
* last change:$Date: 2003-09-08 11:48:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -58,23 +58,10 @@
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
package mod._forms;
|
||||
|
||||
import com.sun.star.awt.XControlModel;
|
||||
import com.sun.star.lang.XMultiServiceFactory;
|
||||
import com.sun.star.awt.XDevice;
|
||||
import com.sun.star.awt.XGraphics;
|
||||
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;
|
||||
@@ -84,6 +71,22 @@ import util.SOfficeFactory;
|
||||
import util.WriterTools;
|
||||
import util.utils;
|
||||
|
||||
import com.sun.star.awt.XControlModel;
|
||||
import com.sun.star.awt.XDevice;
|
||||
import com.sun.star.awt.XGraphics;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* Test for object which is represented by default controller
|
||||
* of the <code>com.sun.star.form.component.GroupBox</code>
|
||||
@@ -109,31 +112,39 @@ import util.utils;
|
||||
* @see ifc.awt._XView
|
||||
*/
|
||||
public class OGroupBoxControl extends TestCase {
|
||||
|
||||
XTextDocument xTextDoc;
|
||||
|
||||
/**
|
||||
* Creates a new text document.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes the text document created before
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,26 +176,27 @@ public class OGroupBoxControl extends TestCase {
|
||||
* component. </li>
|
||||
* </ul>
|
||||
*/
|
||||
public TestEnvironment createTestEnvironment( TestParameters Param,
|
||||
PrintWriter log )
|
||||
throws StatusException {
|
||||
protected TestEnvironment createTestEnvironment(TestParameters Param,
|
||||
PrintWriter log) {
|
||||
XInterface oObj = null;
|
||||
Object anotherCtrl = null ;
|
||||
Object anotherCtrl = null;
|
||||
XWindowPeer the_win = null;
|
||||
XWindowPeer the_win2 = null;
|
||||
XToolkit the_kit = null;
|
||||
XDevice aDevice = null;
|
||||
XGraphics aGraphic = null;
|
||||
|
||||
//Insert a ControlShape and get the ControlModel
|
||||
XControlShape aShape = FormTools.createControlShape(
|
||||
xTextDoc,5000, 7000, 2000, 2000, "GroupBox");
|
||||
XControlShape aShape = FormTools.createControlShape(xTextDoc, 5000,
|
||||
7000, 2000, 2000,
|
||||
"GroupBox");
|
||||
|
||||
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);
|
||||
|
||||
@@ -192,7 +204,8 @@ public class OGroupBoxControl extends TestCase {
|
||||
|
||||
//Try to query XControlAccess
|
||||
XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
|
||||
XControlAccess.class,xTextDoc.getCurrentController());
|
||||
XControlAccess.class,
|
||||
xTextDoc.getCurrentController());
|
||||
|
||||
//now get the OGroupBoxControl
|
||||
try {
|
||||
@@ -200,33 +213,36 @@ public class OGroupBoxControl extends TestCase {
|
||||
anotherCtrl = 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 (com.sun.star.container.NoSuchElementException e) {
|
||||
log.println("Couldn't get OGroupBoxControl");
|
||||
e.printStackTrace(log);
|
||||
throw new StatusException("Couldn't get OGroupBoxControl", e );
|
||||
throw new StatusException("Couldn't get OGroupBoxControl", e);
|
||||
}
|
||||
|
||||
log.println( "creating a new environment for OGroupBoxControl object" );
|
||||
TestEnvironment tEnv = new TestEnvironment( oObj );
|
||||
log.println("creating a new environment for OGroupBoxControl 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);
|
||||
log.println("ImplementationName: "+utils.getImplName(oObj));
|
||||
tEnv.addObjRelation("CONTEXT", xTextDoc);
|
||||
tEnv.addObjRelation("WINPEER", the_win);
|
||||
tEnv.addObjRelation("TOOLKIT", the_kit);
|
||||
tEnv.addObjRelation("MODEL", the_Model);
|
||||
log.println("ImplementationName: " + utils.getImplName(oObj));
|
||||
|
||||
|
||||
// Adding relation for XWindow
|
||||
tEnv.addObjRelation("XWindow.AnotherWindow", UnoRuntime.queryInterface
|
||||
(XWindow.class, anotherCtrl));
|
||||
tEnv.addObjRelation("XWindow.AnotherWindow",
|
||||
UnoRuntime.queryInterface(XWindow.class,
|
||||
anotherCtrl));
|
||||
|
||||
return tEnv;
|
||||
} // finish method getTestEnvironment
|
||||
|
||||
} // finish class OGroupBoxControl
|
||||
|
||||
} // finish class OGroupBoxControl
|
||||
|
||||
Reference in New Issue
Block a user