Ejemplo n.º 1
0
  /**
   * Retrieves all relations. If optional ones are not found creates their default values.
   *
   * <p>
   *
   * @throws StatusException If one of required relations not found.
   */
  public void before() {
    url = (String) tEnv.getObjRelation("FrameLoader.URL");
    frame = (XFrame) tEnv.getObjRelation("FrameLoader.Frame");

    if (frame == null) {
      SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory) tParam.getMSF());

      try {
        log.println("creating a textdocument");
        frameSup = SOF.createTextDoc(null);

        Object oDsk =
            ((XMultiServiceFactory) tParam.getMSF()).createInstance("com.sun.star.frame.Desktop");
        XDesktop dsk = UnoRuntime.queryInterface(XDesktop.class, oDsk);

        shortWait();
        frame = dsk.getCurrentFrame();
      } catch (com.sun.star.uno.Exception e) {
        // Some exception occurs.FAILED
        e.printStackTrace(log);
        throw new StatusException("Couldn't create a frame.", e);
      }
    }

    Object args = tEnv.getObjRelation("FrameLoader.args");
    if (args != null) this.args = (PropertyValue[]) args;

    if (url == null /*|| frame == null*/) {
      throw new StatusException(Status.failed("Some relations not found"));
    }
  }
Ejemplo n.º 2
0
  @Override
  protected void initialize(TestParameters Param, PrintWriter log) throws Exception {
    SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF());

    log.println("creating a textdocument");
    xTextDoc = SOF.createTextDoc(null);

    log.println("maximize the window size");
    XModel xModel = UnoRuntime.queryInterface(XModel.class, xTextDoc);
    XFrame xFrame = xModel.getCurrentController().getFrame();
    XWindow xWin = xFrame.getContainerWindow();

    Toolkit.getDefaultToolkit();
    Dimension dim = new Dimension(800, 600);

    Rectangle newPosSize = xWin.getPosSize();
    newPosSize.Width = new Double(dim.getWidth()).intValue();
    newPosSize.Height = new Double(dim.getHeight()).intValue();
    newPosSize.X = 0;
    newPosSize.Y = 0;

    xWin.setPosSize(
        newPosSize.X,
        newPosSize.Y,
        newPosSize.Width,
        newPosSize.Height,
        com.sun.star.awt.PosSize.POSSIZE);
  }
Ejemplo n.º 3
0
 /** Creates text document. */
 protected void initialize(TestParameters tParam, PrintWriter log) {
   SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory) tParam.getMSF());
   try {
     log.println("creating a textdocument");
     xTextDoc = SOF.createTextDoc(null);
   } catch (com.sun.star.uno.Exception e) {
     e.printStackTrace(log);
     throw new StatusException("Couldn't create document", e);
   }
 }
Ejemplo n.º 4
0
  /**
   * creates a text document and check the <CODE>XMouseClickHandler</CODE> and <CODE>XKeyHandler
   * </CODE>
   *
   * @see com.sun.star.awt.XKeyHandler
   * @see com.sun.star.awt.XMouseClickHandler
   */
  @Test
  public void checkTextDocument() {

    XTextDocument xDoc = null;

    try {
      xDoc = m_SOF.createTextDoc("WriterTest");
    } catch (com.sun.star.uno.Exception e) {
      fail("Could not create a text document: " + e.toString());
    }

    checkListener(xDoc);

    closeDoc(xDoc);
  }
Ejemplo n.º 5
0
  /**
   * Called to create an instance of <code>TestEnvironment</code> with an object to test and related
   * objects. Subclasses should implement this method to provide the implementation and related
   * objects. The method is called from <code>getTestEnvironment()</code>.
   *
   * @param tParam test parameters
   * @param log writer to log information while testing
   * @see TestEnvironment
   * @see #getTestEnvironment
   */
  @Override
  protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log)
      throws Exception {

    log.println("creating a test environment");

    if (xTextDoc != null) {
      xTextDoc.dispose(); // get a soffice factory object
    }
    SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF());

    log.println("creating a text document");
    xTextDoc = SOF.createTextDoc(null);

    util.utils.waitForEventIdle(tParam.getMSF());

    XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc);

    XController secondController = aModel1.getCurrentController();

    XDispatchProvider aProv = UnoRuntime.queryInterface(XDispatchProvider.class, secondController);

    XDispatch getting = null;

    log.println("opening DatasourceBrowser");
    URL the_url = new URL();
    the_url.Complete = ".component:DB/DataSourceBrowser";
    getting = aProv.queryDispatch(the_url, "_beamer", 12);
    PropertyValue[] noArgs = new PropertyValue[0];
    getting.dispatch(the_url, noArgs);

    util.utils.waitForEventIdle(tParam.getMSF());

    XFrame the_frame1 = the_Desk.getCurrentFrame();

    if (the_frame1 == null) {
      log.println("Current frame was not found !!!");
    }

    XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);

    the_frame2.setName("DatasourceBrowser");

    XInterface oObj = null;

    final XSelectionSupplier xSelect =
        UnoRuntime.queryInterface(XSelectionSupplier.class, the_frame2.getController());

    PropertyValue[] params =
        new PropertyValue[] {new PropertyValue(), new PropertyValue(), new PropertyValue()};
    params[0].Name = "DataSourceName";
    params[0].Value = "Bibliography";
    params[1].Name = "CommandType";
    params[1].Value = Integer.valueOf(com.sun.star.sdb.CommandType.TABLE);
    params[2].Name = "Command";
    params[2].Value = "biblio";

    final PropertyValue[] fParams = params;

    util.utils.waitForEventIdle(tParam.getMSF());

    XWindow xWindow = secondController.getFrame().getContainerWindow();

    XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);

    AccessibilityTools.printAccessibleTree(
        log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));

    oObj =
        AccessibilityTools.getAccessibleObjectForRole(
            xRoot, AccessibleRole.PANEL, "", "AccessibleBrowseBox");

    log.println("ImplementationName: " + util.utils.getImplName(oObj));

    TestEnvironment tEnv = new TestEnvironment(oObj);

    tEnv.addObjRelation(
        "EventProducer",
        new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {

          public void fireEvent() {
            try {
              xSelect.select(fParams);
            } catch (com.sun.star.lang.IllegalArgumentException e) {
              e.printStackTrace();
            }
          }
        });

    return tEnv;
  }
Ejemplo n.º 6
0
 /** Creates text document. */
 @Override
 protected void initialize(TestParameters tParam, PrintWriter log) throws Exception {
   SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF());
   log.println("creating a textdocument");
   xTextDoc = SOF.createTextDoc(null);
 }