Search in sources :

Example 36 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ImagePanelLayoutTest method getDimensionsWhenNotAuto.

@Test
public void getDimensionsWhenNotAuto() throws Exception {
    panel.setFilename(TestUtil.DATA_DIR + "/star.gif");
    parent.style.setWidth("100");
    parent.style.setHeight("150");
    parent.childConsumableBounds = new Box(0, 0, 100, 150);
    Layouts.on(parent, parent.getDefaultLayout());
    assertEquals(100, panel.getWidth());
    assertEquals(150, panel.getHeight());
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 37 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ScrollMouseProcessorTest method mouseInSliderScrollConditionHorizontal.

@Test
public void mouseInSliderScrollConditionHorizontal() throws Exception {
    setUpHorizontally();
    scrollBar.setValue(10);
    Box sliderBounds = scrollBar.getSliderBounds();
    final ScrollRepeater.ScrollCondition condition = processor.getNotInSliderScrollCondition();
    processor.setMouseLocation(sliderBounds.left() - 1, 7);
    assertEquals(true, condition.canScroll());
    processor.setMouseLocation(sliderBounds.left() + 1, 7);
    assertEquals(false, condition.canScroll());
    processor.setMouseLocation(sliderBounds.right() - 1, 7);
    assertEquals(false, condition.canScroll());
    processor.setMouseLocation(sliderBounds.right() + 1, 7);
    assertEquals(true, condition.canScroll());
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 38 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ScrollMouseProcessorTest method mouseInSliderScrollConditionVertical.

@Test
public void mouseInSliderScrollConditionVertical() throws Exception {
    setUpVertically();
    scrollBar.setValue(10);
    Box sliderBounds = scrollBar.getSliderBounds();
    final ScrollRepeater.ScrollCondition condition = processor.getNotInSliderScrollCondition();
    processor.setMouseLocation(7, sliderBounds.top() - 1);
    assertEquals(true, condition.canScroll());
    processor.setMouseLocation(7, sliderBounds.top() + 1);
    assertEquals(false, condition.canScroll());
    processor.setMouseLocation(7, sliderBounds.bottom() - 1);
    assertEquals(false, condition.canScroll());
    processor.setMouseLocation(7, sliderBounds.bottom() + 1);
    assertEquals(true, condition.canScroll());
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 39 with Box

use of limelight.util.Box in project limelight by slagyr.

the class PropPanelTest method marginedBoundsIncludeMarginButIgnoreLocation.

@Test
public void marginedBoundsIncludeMarginButIgnoreLocation() throws Exception {
    panel.setLocation(3, 3);
    panel.setSize(50, 50);
    panel.getStyle().setMargin(5);
    final Box bounds = panel.getMarginedBounds();
    assertEquals(5, bounds.x);
    assertEquals(5, bounds.y);
    assertEquals(40, bounds.width);
    assertEquals(40, bounds.height);
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 40 with Box

use of limelight.util.Box in project limelight by slagyr.

the class PanelPainterLoop method paintDirtyRegions.

public void paintDirtyRegions(Scene root) {
    regionBuffer.clear();
    root.getAndClearDirtyRegions(regionBuffer);
    for (Rectangle rectangle : regionBuffer) {
        if (rectangle.width <= 0 || rectangle.height <= 0)
            continue;
        Graphics2D rootGraphics = root.getGraphics();
        if (rootGraphics != null) {
            doPaintJob(root, new Box(rectangle), rootGraphics);
        }
    }
}
Also used : Box(limelight.util.Box)

Aggregations

Box (limelight.util.Box)80 Test (org.junit.Test)31 MockGraphics (limelight.ui.MockGraphics)11 Before (org.junit.Before)6 AffineTransform (java.awt.geom.AffineTransform)5 Style (limelight.styles.Style)3 TextLocation (limelight.ui.text.TextLocation)3 TypedLayout (limelight.ui.text.TypedLayout)3 BufferedImage (java.awt.image.BufferedImage)2 Panel (limelight.ui.Panel)2 TextLayout (java.awt.font.TextLayout)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LimelightException (limelight.LimelightException)1 FlatStyle (limelight.styles.FlatStyle)1 StringValue (limelight.styles.abstrstyling.StringValue)1 AutoDimensionValue (limelight.styles.values.AutoDimensionValue)1 GreedyDimensionValue (limelight.styles.values.GreedyDimensionValue)1 BufferedImagePool (limelight.ui.BufferedImagePool)1 MockPanel (limelight.ui.MockPanel)1