/** * Verifies, whether value exists in row.. * * @param row The row of the cell. * @param rowOperator the row header operator * @param value The cell text to verify. * @param operator The operation used to verify * @param searchType Determines where the search begins ("relative" or "absolute") * @param exists true if value exists, false otherwise * @throws StepExecutionException If the row or the column is invalid, or if the rendered text * cannot be extracted. */ public void rcVerifyValueInRow( final String row, final String rowOperator, final String value, final String operator, final String searchType, boolean exists) throws StepExecutionException { final TreeTableOperationContext adapter = getContext(); final int implRow = adapter.getRowFromString(row, rowOperator); boolean valueIsExisting = false; // if row is header if (implRow == -1) { for (int i = getStartingColIndex(searchType); i < adapter.getColumnCount(); ++i) { if (MatchUtil.getInstance().match(adapter.getColumnHeaderText(i), value, operator)) { valueIsExisting = true; break; } } } else { for (int i = getStartingColIndex(searchType); i < adapter.getColumnCount(); ++i) { if (MatchUtil.getInstance().match(getCellText(implRow, i), value, operator)) { valueIsExisting = true; break; } } } Verifier.equals(exists, valueIsExisting); }
/** * method to compare a string to the system clipboard * * @param operator the comparison method * @param text the text for comparison */ public void rcCheckClipboard(final String operator, final String text) { String content = null; try { content = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); } catch (IllegalStateException ise) { throw new StepExecutionException( "Clipboard not available.", //$NON-NLS-1$ EventFactory.createActionError(TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); } catch (HeadlessException he) { throw new StepExecutionException( "Clipboard not available.", //$NON-NLS-1$ EventFactory.createActionError(TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); } catch (UnsupportedFlavorException ufe) { throw new StepExecutionException( "Unsupported Clipboard content.", //$NON-NLS-1$ EventFactory.createActionError(TestErrorEvent.CLIPBOARD_UNSUPPORTED_FLAVOR)); } catch (IOException ioe) { throw new StepExecutionException( "Clipboard could not be compared.", //$NON-NLS-1$ EventFactory.createActionError(TestErrorEvent.CLIPBOARD_IO_ERROR)); } Verifier.match(content, text, operator); }
/** * Verifies the text of the cell under the mouse * * @param txt the text * @param operator the operator */ public void rcVerifyCellTextAtMousePosition(String txt, String operator) { String result = EventThreadQueuerJavaFXImpl.invokeAndWait( "rcVerifyCellTextAtMousePosition", new Callable<String>() { // $NON-NLS-1$ @Override public String call() throws Exception { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) getNodeAtMousePosition(); return getContext().getRenderedText(cell); } }); Verifier.match(result, txt, operator); }
/** * Verifies if the selected node underneath <code>treePath</code> at column <code>column</code> * has a rendered text which is equal to <code>selection</code>. * * @param pattern the pattern * @param operator The operator to use when comparing the expected and actual values. * @param column the column or column path of the item to select * @param colOperator the operator for the column path * @throws StepExecutionException If there is no tree node selected, the tree path contains no * selection or the verification fails */ public void rcVerifySelectedValueAtPath( String pattern, String operator, String column, String colOperator) throws StepExecutionException { TreeTableOperationContext context = getContext(); final int implCol = context.getColumnFromString(column, colOperator, true); checkColumnIndex(implCol); context.setColumn(implCol); String text = context.getRenderedTextOfColumn(context.getSelectedNode()); Verifier.match(text, pattern, operator); }
/** * Verifies if the selected node underneath <code>treePath</code> at column <code>column</code> * has a rendered text which is equal to <code>selection</code>. * * @param pattern the pattern * @param operator The operator to use when comparing the expected and actual values. * @param column The column containing the text to verify * @throws StepExecutionException If there is no tree node selected, the tree path contains no * selection or the verification fails */ public void rcVerifySelectedValue(String pattern, String operator, int column) throws StepExecutionException { final int implCol = IndexConverter.toImplementationIndex(column); checkColumnIndex(implCol); TreeTableOperationContext context = getContext(); context.setColumn(implCol); String text = context.getRenderedTextOfColumn(context.getSelectedNode()); Verifier.match(text, pattern, operator); }
/** * Verifies, whether value exists in column. * * @param col The column of the cell. * @param colOperator the column header operator * @param value The cell text to verify. * @param operator The operation used to verify * @param searchType Determines where the search begins ("relative" or "absolute") * @param exists true if value exists, false otherwise * @throws StepExecutionException If the row or the column is invalid, or if the rendered text * cannot be extracted. */ public void rcVerifyValueInColumn( final String col, final String colOperator, final String value, final String operator, final String searchType, boolean exists) throws StepExecutionException { TreeTableOperationContext adapter = getContext(); final int implCol = adapter.getColumnFromString(col, colOperator, true); boolean valueExists = isValueExisting(adapter, implCol, value, operator, searchType); Verifier.equals(exists, valueExists); }
/** * Verifies the rendered text inside the passed cell. * * @param row The row of the cell. * @param rowOperator The row header operator * @param col The column of the cell. * @param colOperator The column header operator * @param text The cell text to verify. * @param operator The operation used to verify * @throws StepExecutionException If the row or the column is invalid, or if the rendered text * cannot be extracted. */ public void rcVerifyText( String text, String operator, final String row, final String rowOperator, final String col, final String colOperator) throws StepExecutionException { TreeTableOperationContext adapter = getContext(); final int implRow = adapter.getRowFromString(row, rowOperator); final int implCol = adapter.getColumnFromString(col, colOperator, implRow != -1); String current; // if row is header and column is existing if (implRow == -1 && implCol > -1) { current = adapter.getColumnHeaderText(implCol); } else { checkRowColBounds(implRow, implCol); adapter.scrollCellToVisible(implRow, implCol); current = getCellText(implRow, implCol); } Verifier.match(current, text, operator); }
/** * method to compare to strings * * @param value1 the first value for comparison * @param operator the comparison method * @param value2 the second value for comparison */ public void rcCheckStringValues(final String value1, final String operator, final String value2) { Verifier.match(value1, value2, operator); }
/** * Verifies the editable property of the cell under the mouse. * * @param editable The editable property to verify. */ public void rcVerifyEditableAtMousePosition(boolean editable) { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) getNodeAtMousePosition(); Verifier.equals(editable, getContext().isCellEditable(cell)); }
/** * Verifies the editable property of the current selected cell. * * @param editable The editable property to verify. */ public void rcVerifySelectedEditable(boolean editable) { Cell cell = getContext().getSelectedCell(); Verifier.equals(editable, getContext().isCellEditable(cell.getRow(), cell.getCol())); }