@Test
  public void testSetName() {
    final String oldName = myShop.getName();

    assertEquals(myShop.getName(), myShopName.getText());

    myShop.setName(oldName + "--");
    assertEquals(oldName + "--", myShop.getName());
    assertEquals(oldName + "--", myShopName.getText());

    myShop.setName(oldName);
  }
示例#2
0
  /** Tests the different supported patterns */
  @Test
  public void filterPatternTest() {
    IFilteringTableAdapter.Factory.adapt(myViewer, myFilter);

    // Empty
    // myFilter.setText("");
    // yield();
    // assertEquals(myShop.getCountries().size(), myTable.getItemCount());

    // Plain
    myFilter.setText("A");
    yield();
    assertEquals(1, myTable.getItemCount());

    // Star
    myFilter.setText("*A");
    yield();
    assertEquals(2, myTable.getItemCount());

    // CamelCase
    myFilter.setText("BB");
    yield();
    assertEquals(1, myTable.getItemCount());

    // Empty
    myFilter.setText("");
    yield();
    assertEquals(myShop.getCountries().size(), myTable.getItemCount());
  }
示例#3
0
  /** Tests the navigation between the filter and the table. */
  @Test
  public void navigationTest() {
    IFilteringTableAdapter.Factory.adapt(myViewer, myFilter);

    myFilter.setText("");
    assertEquals(myShop.getCountries().size(), myTable.getItemCount());

    myFilter.setFocus();

    postKeyStroke(myFilter, "ARROW_DOWN");
    yield();

    assertTrue(myTable.isFocusControl());
    assertEquals(0, myTable.getSelectionIndex());

    postKeyStroke(myTable, "ARROW_DOWN");
    yield();

    assertTrue(myTable.isFocusControl());
    assertEquals(1, myTable.getSelectionIndex());

    postKeyStroke(myTable, "ARROW_UP");
    yield();

    assertTrue(myTable.isFocusControl());
    assertEquals(0, myTable.getSelectionIndex());

    postKeyStroke(myTable, "ARROW_UP");
    yield();

    assertTrue(myFilter.isFocusControl());
  }
  /** Creates the shop itself */
  public void createShop() {
    myShop = ShopFactory.eINSTANCE.createShop();

    Country c;

    c = ShopFactory.eINSTANCE.createCountry();
    c.setName("A");
    c.setAbbreviation("AA");
    myShop.getCountries().add(c);

    c = ShopFactory.eINSTANCE.createCountry();
    c.setName("2A");
    c.setAbbreviation("BarBar");
    myShop.getCountries().add(c);

    c = ShopFactory.eINSTANCE.createCountry();
    c.setName("C");
    c.setAbbreviation("CC");
    myShop.getCountries().add(c);
  }
  @Before
  public void before() {
    resetAll();
    IManager.Factory.getManager().setValidationDelay(VD);

    myView = UIBindingsTestUtils.createUIBTestView(this);

    myShop = ShopFactory.eINSTANCE.createShop();
    myShop.setName(myInitValue);

    myForm = myView.createFormCreator(myShop);
  }
  /** Creates the shop itself */
  public void createShop() {
    myShop = ShopFactory.eINSTANCE.createShop();

    myCountry1 = ShopFactory.eINSTANCE.createCountry();
    myCountry1.setName("n1");
    myCountry1.setAbbreviation("1");
    myShop.getCountries().add(myCountry1);

    myCountry2 = ShopFactory.eINSTANCE.createCountry();
    myCountry2.setName("n2");
    myCountry2.setAbbreviation("2");
    myShop.getCountries().add(myCountry2);

    myCountry3 = ShopFactory.eINSTANCE.createCountry();
    myCountry3.setName("n3");
    myCountry3.setAbbreviation("3");
    myShop.getCountries().add(myCountry3);

    myCountry4 = ShopFactory.eINSTANCE.createCountry();
    myCountry4.setName("n4");
    myCountry4.setAbbreviation("4");
    myShop.getCountries().add(myCountry4);

    myContact1 = ShopFactory.eINSTANCE.createContact();
    myContact1.setName("a");
    myContact1.setCountry(myCountry1);
    myShop.getContacts().add(myContact1);

    myContact2 = ShopFactory.eINSTANCE.createContact();
    myContact2.setName("b");
    myContact2.setCountry(myCountry2);
    myShop.getContacts().add(myContact2);
  }
 private void createModel() {
   myShop = ShopFactory.eINSTANCE.createShop();
   myShop.setName("NWS");
   myBoolOV = WritableValue.withValueType(EcorePackage.Literals.EBOOLEAN);
 }
 private void createModel() {
   myShop = ShopFactory.eINSTANCE.createShop();
   myShop.setName("NoName");
 }