예제 #1
0
파일: Text_Test.java 프로젝트: ciancu/rap
  @Test
  public void testIsSerializable() throws Exception {
    text.setText("foo");

    Text deserializedText = Fixture.serializeAndDeserialize(text);

    assertEquals(text.getText(), deserializedText.getText());
  }
  @Test
  public void testSerializableFields() throws Exception {
    WidgetAdapterImpl adapter = new WidgetAdapterImpl("id");
    adapter.setInitialized(true);

    WidgetAdapterImpl deserializedAdapter = Fixture.serializeAndDeserialize(adapter);

    assertEquals(adapter.getId(), deserializedAdapter.getId());
    assertTrue(deserializedAdapter.isInitialized());
  }
  @Test
  public void testNonSerializableFields() throws Exception {
    String property = "foo";
    WidgetAdapterImpl adapter = new WidgetAdapterImpl("id");
    adapter.setCachedVariant("cachedVariant");
    adapter.setRenderRunnable(mock(IRenderRunnable.class));
    adapter.preserve(property, "bar");

    WidgetAdapterImpl deserializedAdapter = Fixture.serializeAndDeserialize(adapter);

    assertNull(deserializedAdapter.getCachedVariant());
    assertNull(deserializedAdapter.getRenderRunnable());
    assertNull(deserializedAdapter.getPreserved(property));
  }
예제 #4
0
  @Test
  public void testIsSerializable() throws Exception {
    String itemText = "item0";
    Tree tree = new Tree(shell, SWT.NONE);
    new TreeColumn(tree, SWT.NONE);
    new TreeColumn(tree, SWT.NONE);
    TreeItem item = new TreeItem(tree, SWT.NONE);
    item.setText(itemText);
    TreeEditor treeEditor = new TreeEditor(tree);
    treeEditor.setColumn(1);
    treeEditor.setItem(item);

    TreeEditor deserializedTreeEditor = Fixture.serializeAndDeserialize(treeEditor);

    attachThread(deserializedTreeEditor.getItem().getDisplay());
    assertEquals(1, deserializedTreeEditor.getColumn());
    assertEquals(itemText, deserializedTreeEditor.getItem().getText());
  }