public void selectVariableAndSetValueInSearchTab(String variableNameEndsWith, double value) { JPanelFixture searchPanel = focusedWindow.panel("SearchPanel"); JPanelFixture searchVarListVarPanel = searchPanel.panel("Search"); JSpinnerNameEndsWithMatcher matcher = new JSpinnerNameEndsWithMatcher(variableNameEndsWith); JSpinnerFixture spinner = searchVarListVarPanel.spinner(matcher); spinner.click(); spinner.enterTextAndCommit(String.valueOf(value)); }
public void selectVariableInSearchTab(String variableNameEndsWith) { JPanelFixture searchPanel = focusedWindow.panel("SearchPanel"); JPanelFixture searchVarListVarPanel = searchPanel.panel("Search"); JSpinnerNameEndsWithMatcher matcher = new JSpinnerNameEndsWithMatcher(variableNameEndsWith); // Focusing the spinner seems to do the trick, though this seems hackish and brittle. JSpinnerFixture spinner = searchVarListVarPanel.spinner(matcher); spinner.focus(); }
public void findEntryBoxAndEnterValue(String name, double value) { JPanelFixture entryBoxArrayPanel = focusedWindow.panel("EntryBoxArrayPanel"); JPanelFixture enumEntryBox = entryBoxArrayPanel.panel(name + "_YoEntryBox"); JTextComponentFixture textBox = enumEntryBox.textBox(); // For some reason deleting, and then entering doesn't seem to work. It only deletes part of the // text!? // Instead here we have to call setText. // textBox.deleteText(); // textBox.enterText(Double.toString(value) + "\n"); textBox.setText(Double.toString(value)); textBox.enterText("\n"); ThreadTools.sleep(500); }
/** 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"); } }
public void findEnumEntryBoxAndSelectValue(String name, String value) { JPanelFixture entryBoxArrayPanel = focusedWindow.panel("EntryBoxArrayPanel"); JPanelFixture enumEntryBox = entryBoxArrayPanel.panel(name + "_YoEntryBox"); JComboBoxFixture comboBox = enumEntryBox.comboBox(); comboBox.selectItem(value); }