public void testAlignmentChangeShouldInvokeLayout() throws Exception { panel.resetLayout(); panel.styleChanged(Style.HORIZONTAL_ALIGNMENT, null); assertEquals(true, panel.needsLayout()); panel.resetLayout(); panel.styleChanged(Style.VERTICAL_ALIGNMENT, null); assertEquals(true, panel.needsLayout()); }
public void testWidthOrHeightChanges() throws Exception { panel.styleChanged(Style.WIDTH, new StaticDimensionAttribute(20)); assertEquals(true, panel.sizeChangePending()); panel.resetPendingSizeChange(); assertEquals(false, panel.sizeChangePending()); panel.styleChanged(Style.HEIGHT, new StaticDimensionAttribute(20)); assertEquals(true, panel.sizeChangePending()); panel.resetPendingSizeChange(); assertEquals(false, panel.sizeChangePending()); }
public void testChangingTextColor() throws Exception { panel.setText("foo"); panel.resetLayout(); panel.styleChanged(Style.TEXT_COLOR, Style.TEXT_COLOR.compile("red")); assertEquals(true, panel.needsLayout()); }
private void checkLayoutOnStyle(StyleDescriptor styleDescriptor) { Box box = panel.getBoxInsidePadding(); panel.styleChanged(styleDescriptor, new StaticPixelsAttribute(20)); assertEquals(true, panel.needsLayout()); panel.doLayout(); assertNotSame(box, panel.getBoxInsidePadding()); assertEquals(false, panel.needsLayout()); }
public void testShouldPropagateConsumableAreaChangeForBorderChange() throws Exception { MockPanel child = new MockPanel(); panel.add(child); panel.styleChanged(Style.TOP_BORDER_WIDTH, new SimpleIntegerAttribute(5)); assertEquals(true, child.consumableAreaChangedCalled); }
public void testShouldPropagateConsumableAreaChangeForWidthChange() throws Exception { MockPanel child = new MockPanel(); panel.add(child); panel.styleChanged(Style.WIDTH, new StaticDimensionAttribute(20)); assertEquals(true, child.consumableAreaChangedCalled); }
public void testShouldNotBuildBufferWhenTransparencyChanges() throws Exception { SimpleCache<limelight.ui.Panel, BufferedImage> cache = new SimpleCache<limelight.ui.Panel, BufferedImage>(); Context.instance().bufferedImageCache = cache; cache.cache(panel, new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB)); panel.styleChanged(Style.TRANSPARENCY, new SimplePercentageAttribute(20)); assertNotNull(cache.retrieve(panel)); }
public void testShouldBuildBufferWhenStyleChanges() throws Exception { SimpleCache<limelight.ui.Panel, BufferedImage> cache = new SimpleCache<limelight.ui.Panel, BufferedImage>(); Context.instance().bufferedImageCache = cache; cache.cache(panel, new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB)); panel.styleChanged(Style.WIDTH, new StaticDimensionAttribute(20)); assertEquals(null, cache.retrieve(panel)); }
public void testChangingFontStyle() throws Exception { panel.setText("foo"); panel.resetLayout(); panel.resetPendingSizeChange(); panel.styleChanged(Style.FONT_STYLE, Style.FONT_STYLE.compile("italic")); assertEquals(true, panel.needsLayout()); assertEquals(true, panel.sizeChangePending()); }
public void testChangingSizeToZeroWillReLayoutGrandDaddy() throws Exception { PropPanel child = new PropPanel(new MockProp()); PropPanel grandChild = new PropPanel(new MockProp()); panel.add(child); child.add(grandChild); child.resetLayout(); panel.resetLayout(); grandChild.styleChanged(Style.HEIGHT, new StaticDimensionAttribute(0)); assertEquals(true, panel.needsLayout()); }
private void checkBorderChanged(StyleDescriptor styleDescriptor) { panel.styleChanged(styleDescriptor, new SimpleIntegerAttribute(5)); assertEquals(true, panel.borderChanged()); panel.doLayout(); assertEquals(false, panel.borderChanged()); }