Ejemplo n.º 1
0
  /**
   * check minValue and maxValue
   *
   * <p>inputNumberSlider has next structure <code>
   * 	<table>
   * 			<tr>
   * 				<td>minValue</td>
   * 				<td>maxValue</td>
   * 			</tr>
   *  		....
   *  	</table>
   *  </code>
   */
  private void checkMinMaxValue(
      nsIDOMNode defaultInputSlider, int expectedMinValue, int expectedMaxValue) {

    // get "tr" element
    nsIDOMNode trNode = defaultInputSlider.getChildNodes().item(0);
    assertNotNull(trNode);
    // get first "td" element which contain minValue
    nsIDOMNode td1Node = trNode.getChildNodes().item(0);
    assertNotNull(td1Node);

    // get second "td" element which contain maxValue
    nsIDOMNode td2Node = trNode.getChildNodes().item(1);
    assertNotNull(td2Node);

    // get minValue
    nsIDOMNode minValue = td1Node.getChildNodes().item(0);
    assertNotNull(minValue);

    // get maxValue
    nsIDOMNode maxValue = td2Node.getChildNodes().item(0);
    assertNotNull(maxValue);

    // check min value
    String minValueString = minValue.getNodeValue();
    assertNotNull(minValueString);
    assertEquals(expectedMinValue, Integer.parseInt(minValueString));

    // check max value
    String maxValueString = maxValue.getNodeValue();
    assertNotNull(maxValueString);
    assertEquals(expectedMaxValue, Integer.parseInt(maxValueString));

    return;
  }
  /**
   * Asserts selected node in Visual pane has text textToHave
   *
   * @param webBrowser
   * @param nodeNameToContain
   */
  private static void assertSelectedNodeHasText(SWTBotWebBrowser webBrowser, String textToHave) {

    nsIDOMNode selectedNode = webBrowser.getSelectedDomNode();

    assertNotNull("There is no selected node within Visual pane of VPE", selectedNode);
    assertNotNull(
        "Selected node within Visual pane of VPE has no value", selectedNode.getNodeValue());

    final String nodeValue = selectedNode.getNodeValue();

    assertTrue(
        "Selected node within Visual pane has value:\n"
            + nodeValue
            + "\nbut has to have value:\n"
            + textToHave,
        textToHave.equals(nodeValue));
  }