public void clickOnUnusedEntryBox() {
    JPanelFixture unusedEntryBox = focusedWindow.panel("UNUSED");
    unusedEntryBox.click();

    LabelTextMatcher matcher = new LabelTextMatcher("UNUSED");
    JLabelFixture label = unusedEntryBox.label(matcher);
    label.click();
  }
Beispiel #2
0
  /** Bug 493 test. */
  @Test
  public void testBug493() {
    System.err.println(new Exception().getStackTrace()[0].getMethodName());

    String varName = "t";
    String varType = "TEXT";
    String varRadio = varType.toLowerCase() + "TypeButton";

    String[] testInput = {
      "Subject stands up ", "$10,432", "Hand me the manual!",
      "Tote_that_bale", "Jeune fille celebre", "If x?7 then x? 2"
    };

    String[] expectedTestOutput = testInput;

    // 1. Create new TEXT variable
    mainFrameFixture.createNewVariable(varName, varRadio);

    // 2. Check that a column has been created
    JPanelFixture ssPanel = mainFrameFixture.getSpreadsheet();

    // Find our new column header
    JLabelFixture column = ssPanel.panel("headerView").label();

    // 3. Create cell, paste text and press enter, for each testInput
    for (int i = 0; i < testInput.length; i++) {

      // a. Create cell
      column.click();
      mainFrameFixture.clickMenuItemWithPath("Spreadsheet", "New Cell");

      // b. Paste text
      UIUtils.setClipboard(testInput[i]);

      JTextComponentFixture cell =
          mainFrameFixture.textBox(JTextComponentMatcher.withText("<val>"));
      cell.click();
      cell.pressAndReleaseKey(
          KeyPressInfo.keyCode(KeyEvent.VK_V).modifiers(Platform.controlOrCommandMask()));

      // c. Press Enter
      mainFrameFixture.robot.pressKey(KeyEvent.VK_ENTER);

      // d. Check text
      Assert.assertEquals(cell.text(), expectedTestOutput[i] + "\n");
    }
  }