use of org.eclipse.wb.internal.core.databinding.ui.ObserveType in project windowbuilder by eclipse.
the class DatabindingsProviderTest method test_common.
// //////////////////////////////////////////////////////////////////////////
//
// Tests
//
// //////////////////////////////////////////////////////////////////////////
public void test_common() throws Exception {
CompositeInfo shell = parseComposite("public class Test {", " protected Shell m_shell;", " public static void main(String[] args) {", " Test test = new Test();", " test.open();", " }", " public void open() {", " Display display = new Display();", " createContents();", " m_shell.open();", " m_shell.layout();", " while (!m_shell.isDisposed()) {", " if (!display.readAndDispatch()) {", " display.sleep();", " }", " }", " }", " protected void createContents() {", " m_shell = new Shell();", " }", "}");
assertNotNull(shell);
//
DatabindingsProvider provider = getDatabindingsProvider();
//
assertNotNull(provider.getRootInfo());
assertNull(provider.getRootInfo().getInitDataBindings());
assertNotNull(provider.getRootInfo().getContextInfo());
assertNotNull(provider.getRootInfo().getContextInfo().getBindings());
assertTrue(provider.getRootInfo().getContextInfo().getBindings().isEmpty());
assertNull(provider.getRootInfo().getContextInfo().getVariableIdentifier());
//
List<ObserveType> types = provider.getTypes();
assertEquals(2, types.size());
//
assertSame(ObserveType.BEANS, types.get(0));
assertSame(ObserveType.BEANS, provider.getModelStartType());
//
assertSame(ObserveType.WIDGETS, types.get(1));
assertSame(ObserveType.WIDGETS, provider.getTargetStartType());
//
List<ObserveTypeContainer> containers = provider.getContainers();
assertEquals(2, containers.size());
//
assertSame(ObserveType.BEANS, containers.get(0).getObserveType());
assertSame(containers.get(0), provider.getContainer(ObserveType.BEANS));
assertTrue(containers.get(0).isModelStartType());
assertFalse(containers.get(0).isTargetStartType());
//
assertSame(ObserveType.WIDGETS, containers.get(1).getObserveType());
assertSame(containers.get(1), provider.getContainer(ObserveType.WIDGETS));
assertFalse(containers.get(1).isModelStartType());
assertTrue(containers.get(1).isTargetStartType());
}
Aggregations