@Test public void testRenderInitialWidth() throws IOException { lca.render(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(10, message.findCreateProperty(column, "width").asInt()); }
@Test public void testRenderInitialFooterSpan() throws IOException { lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(column, "footerSpan")); }
@Test public void testRenderParent() throws IOException { lca.renderInitialization(column); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation = message.findCreateOperation(column); assertEquals(WidgetUtil.getId(column.getParent()), getParent(operation)); }
@Test public void testRenderVisible() throws IOException { column.setVisible(false); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(JsonValue.FALSE, message.findSetProperty(column, "visibility")); }
@Test public void testRenderMoveable() throws IOException { column.setMoveable(true); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(JsonValue.TRUE, message.findSetProperty(column, "moveable")); }
@Test public void testRenderAlignment() throws IOException { column.setAlignment(SWT.RIGHT); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals("right", message.findSetProperty(column, "alignment").asString()); }
@Test public void testRenderWidth() throws IOException { column.setWidth(50); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(50, message.findSetProperty(column, "width").asInt()); }
@Test public void testRenderIndex() throws IOException { new GridColumn(grid, SWT.NONE, 0); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(1, message.findSetProperty(column, "index").asInt()); }
@Test public void testRenderInitialHeaderWordWrap() throws IOException { lca.render(column); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation = message.findCreateOperation(column); assertTrue(operation.getProperties().names().indexOf("headerWordWrap") == -1); }
@Test public void testRenderCustomVariant() throws IOException { column.setData(RWT.CUSTOM_VARIANT, "blue"); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals("variant_blue", message.findSetProperty(column, "customVariant").asString()); }
@Test public void testRenderHeaderWordWrap() throws IOException { column.setHeaderWordWrap(true); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(JsonValue.TRUE, message.findSetProperty(column, "headerWordWrap")); }
@Test public void testRenderFooterText() throws IOException { column.setFooterText("foo"); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals("foo", message.findSetProperty(column, "footerText").asString()); }
@Test public void testRenderLeft() throws IOException { GridColumn column2 = new GridColumn(grid, SWT.NONE, 0); column2.setWidth(50); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(50, message.findSetProperty(column, "left").asInt()); }
@Test public void testRenderIntialToolTipMarkupEnabled() throws IOException { column.setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE); lca.renderChanges(column); TestMessage message = getProtocolMessage(); assertTrue("foo", message.findSetProperty(column, "toolTipMarkupEnabled").asBoolean()); }
@Test public void testRenderDispose() throws IOException { lca.renderDispose(column); TestMessage message = Fixture.getProtocolMessage(); Operation operation = message.getOperation(0); assertTrue(operation instanceof DestroyOperation); assertEquals(WidgetUtil.getId(column), operation.getTarget()); }
@Test public void testRenderCheck() throws IOException { column = new GridColumn(grid, SWT.CHECK); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(JsonValue.TRUE, message.findSetProperty(column, "check")); }
@Test public void testRenderInitialization_setsOperationHandler() throws IOException { String id = getId(column); lca.renderInitialization(column); OperationHandler handler = RemoteObjectRegistry.getInstance().get(id).getHandler(); assertTrue(handler instanceof GridColumnOperationHandler); }
@Test public void testRenderFooterFont() throws IOException { column.setFooterFont(new Font(display, "Arial", 20, SWT.BOLD)); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); JsonValue actual = message.findSetProperty(column, "footerFont"); assertEquals(JsonArray.readFrom("[[\"Arial\"], 20, true, false]"), actual); }
@Test public void testRenderCreate() throws IOException { lca.renderInitialization(column); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation = message.findCreateOperation(column); assertEquals("rwt.widgets.GridColumn", operation.getType()); assertFalse(operation.getProperties().names().contains("group")); }
@Test public void testRenderToolTipMarkupEnabled() throws IOException { column.setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE); Fixture.markInitialized(column); lca.renderChanges(column); TestMessage message = getProtocolMessage(); assertNull(message.findSetOperation(column, "toolTipMarkupEnabled")); }
@Test public void testRenderFooterSpan() throws IOException { createGridColumns(grid, 3, SWT.NONE); column.setData("footerSpan", Integer.valueOf(2)); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(2, message.findSetProperty(column, "footerSpan").asInt()); }
@Test public void testRenderCreateWithAligment() throws IOException { column = new GridColumn(grid, SWT.RIGHT); lca.render(column); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation = message.findCreateOperation(column); assertTrue(operation.getProperties().names().indexOf("style") == -1); assertEquals("right", message.findCreateProperty(column, "alignment").asString()); }
@Test public void testRenderGroup() throws IOException { GridColumnGroup group = new GridColumnGroup(grid, SWT.NONE); column = new GridColumn(group, SWT.NONE); lca.renderInitialization(column); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation = message.findCreateOperation(column); assertEquals(getId(group), operation.getProperties().get("group").asString()); }
@Test public void testRenderHeaderWordWrapUnchanged() throws IOException { Fixture.markInitialized(display); Fixture.markInitialized(column); column.setHeaderWordWrap(true); Fixture.preserveWidgets(); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(column, "headerWordWrap")); }
@Test public void testRenderVisibleUnchanged() throws IOException { Fixture.markInitialized(display); Fixture.markInitialized(column); column.setVisible(false); Fixture.preserveWidgets(); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(column, "visibility")); }
@Test public void testRenderFooterImage() throws IOException { Image image = loadImage(display, Fixture.IMAGE_100x50); column.setFooterImage(image); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); String imageLocation = ImageFactory.getImagePath(image); JsonArray expected = JsonArray.readFrom("[\"" + imageLocation + "\", 100, 50 ]"); assertEquals(expected, message.findSetProperty(column, "footerImage")); }
@Test public void testRenderFooterTextUnchanged() throws IOException { Fixture.markInitialized(display); Fixture.markInitialized(column); column.setFooterText("foo"); Fixture.preserveWidgets(); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(column, "footerText")); }
@Test public void testRenderCheckUnchanged() throws IOException { column = new GridColumn(grid, SWT.CHECK); Fixture.markInitialized(display); Fixture.markInitialized(column); Fixture.preserveWidgets(); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(column, "check")); }
@Test public void testRenderFontUnchanged() throws IOException { Fixture.markInitialized(display); Fixture.markInitialized(column); column.setHeaderFont(new Font(display, "Arial", 20, SWT.BOLD)); Fixture.preserveWidgets(); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(column, "font")); }
@Test public void testRenderAddSelectionListener() throws Exception { Fixture.markInitialized(display); Fixture.markInitialized(column); Fixture.preserveWidgets(); column.addListener(SWT.Selection, mock(Listener.class)); lca.renderChanges(column); TestMessage message = Fixture.getProtocolMessage(); assertEquals(JsonValue.TRUE, message.findListenProperty(column, "Selection")); }