コード例 #1
0
  public void test_textField_multiple() {
    JTextField field = new JTextField();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une v"));
    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une va"));
    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une vap"));
    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une va"));
    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une val"));
    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une valeur"));

    setValueGesture.receive(list, result);
    assertEquals("Un event est consommé", 5, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"une v\"/>", result.toXml());

    setValueGesture.receive(list, result);
    assertEquals("Un event est consommé", 4, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"une va\"/>", result.toXml());

    setValueGesture.receive(list, result);
    setValueGesture.receive(list, result);
    setValueGesture.receive(list, result);
    setValueGesture.receive(list, result);
    assertEquals("Les events sont consommés", 0, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"une valeur\"/>", result.toXml());
  }
コード例 #2
0
 public synchronized boolean equals(java.lang.Object obj) {
   if (!(obj instanceof SetValue)) return false;
   SetValue other = (SetValue) obj;
   if (obj == null) return false;
   if (this == obj) return true;
   if (__equalsCalc != null) {
     return (__equalsCalc == obj);
   }
   __equalsCalc = obj;
   boolean _equals;
   _equals =
       super.equals(obj)
           && ((this.values == null && other.getValues() == null)
               || (this.values != null
                   && java.util.Arrays.equals(this.values, other.getValues())));
   __equalsCalc = null;
   return _equals;
 }
コード例 #3
0
  public void test_checkbox() {
    JCheckBox field = new JCheckBox();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.CHECKBOX_CLICK, field, Boolean.TRUE));

    setValueGesture.receive(list, result);

    assertEquals("<setValue name=\"myfield\" value=\"true\"/>", result.toXml());
  }
コード例 #4
0
  public void test_combo() {
    JComboBox field = new JComboBox();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_LOST, field, "bb"));

    setValueGesture.receive(list, result);

    assertEquals("Les events sont consommés", 0, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"bb\"/>", result.toXml());
  }
コード例 #5
0
  public void test_textField_multiple_notSame() {
    JTextField field = new JTextField();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.KEY, field, "une val"));
    list.addEvent(newGuiEvent(GuiEventType.KEY, new JTextField(), "autre"));

    setValueGesture.receive(list, result);

    assertEquals("Les events sont consommés", 1, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"une val\"/>", result.toXml());
  }
コード例 #6
0
  public void test_combo_change() {
    JComboBox field = new JComboBox();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_GAIN, field, "aa"));
    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_GAIN, new JComboBox(), "bb"));
    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_LOST, new JComboBox(), "bb"));
    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_LOST, field, "bb"));

    setValueGesture.receive(list, result);
    assertEquals("Rien n'est consommé", 4, list.size());

    // Consomme les 3 premiers events pour tomber sur COMBO_FOCUS_LOST de field.
    list.pop();
    list.pop();
    list.pop();

    setValueGesture.receive(list, result);

    assertEquals("Les events sont consommés", 0, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"bb\"/>", result.toXml());
  }