Package limelight.util

Examples of limelight.util.Box


  {
    panel.setFilename(TestUtil.DATA_DIR + "/star.gif");
    panel.setScaled(false);
    parent.style.setHeight("400");
    parent.style.setHeight("400");
    parent.childConsumableBounds = new Box(0, 0, 400, 400);
    Layouts.on(parent, parent.getDefaultLayout());

    AffineTransform tranform = panel.getTransform();
    assertEquals(1.0, tranform.getScaleX(), 0.001);
    assertEquals(1.0, tranform.getScaleY(), 0.001);
View Full Code Here


  @Before
  public void setUp()
  {
    assumeTrue(TestUtil.notHeadless());
    container = new limelight.ui.model.text.MockTextContainer();
    container.bounds = new Box(0, 0, 150, 75);
    model = new MultiLineTextModel(container);
    model.setTypedLayoutFactory(MockTypedLayoutFactory.instance);
    model.setText("I took the one less traveled by. And that has made all the difference");
  }
View Full Code Here

  public void shouldGetCaretShape() throws Exception
  {
    model.setText("line 1\n line 2\n line 3");

    model.setCaretLocation(TextLocation.at(0, 3));
    assertEquals(new Box(30, 0, 1, 10), model.getCaretShape());

    model.setCaretLocation(TextLocation.at(1, 3));
    assertEquals(new Box(30, 11, 1, 10), model.getCaretShape());

    model.setCaretLocation(TextLocation.at(2, 3));
    assertEquals(new Box(30, 22, 1, 10), model.getCaretShape());
  }
View Full Code Here

    model.setText("1 line\nand\nanother line\n.");
    model.startSelection(TextLocation.origin);

    ArrayList<Box> regions = model.getSelectionRegions();

    assertEquals(new Box(45, 0, 105, 10), regions.get(0));
    assertEquals(new Box(0, 11, 150, 10), regions.get(1));
    assertEquals(new Box(0, 22, 150, 10), regions.get(2));
    assertEquals(new Box(0, 33, 80, 10), regions.get(3));
  }
View Full Code Here

  {
    container.getStyle().setHorizontalAlignment("center");
    model.setText("1 line\nand\nanother line\n.");

    model.setCaretLocation(TextLocation.at(0, 0));
    assertEquals(new Box(45, 0, 1, 10), model.getCaretShape());

    model.setCaretLocation(TextLocation.at(1, 0));
    assertEquals(new Box(60, 11, 1, 10), model.getCaretShape());

    model.setCaretLocation(TextLocation.at(2, 0));
    assertEquals(new Box(15, 22, 1, 10), model.getCaretShape());

    model.setCaretLocation(TextLocation.at(3, 0));
    assertEquals(new Box(70, 33, 1, 10), model.getCaretShape());
  }
View Full Code Here

  public void canGetTheSelectedRegion()
  {
    model.setText("blah");
    model.startSelection(TextLocation.origin);

    assertEquals(new Box(0, 0, 40, 11), model.getSelectionRegions().get(0));
  }
View Full Code Here

    bufferedImageCache = new SimpleCache<Panel, BufferedImage>();
    pool = new BufferedImagePool(1);
    Context.instance().bufferedImageCache = bufferedImageCache;
    Context.instance().bufferedImagePool = pool;

    job = new PaintJob(new Box(100, 200, 300, 400), Colors.TRANSPARENT);
    panel = new MockProp();
    style = panel.style;
    graphics = new MockGraphics();
  }
View Full Code Here

    graphics = new MockGraphics();
  }

  public void testCreation() throws Exception
  {
    Box clip = new Box(1, 2, 3, 4);
    PaintJob job = new PaintJob(clip, Colors.TRANSPARENT);

    assertSame(clip, job.getClip());

    BufferedImage buffer = job.getBuffer();
View Full Code Here

    job.substituteGraphics(graphics);

    job.paint(panel);

    assertEquals(new Box(-99, -198, 1000, 1000), graphics.subGraphics.get(0).clip);
  }
View Full Code Here

  public void testPaintingChildren() throws Exception
  {
    MockProp child = new MockProp();
    panel.add(child);
    panel.childConsumableBounds = new Box(12, 34, 56, 78);
    child.setLocation(123, 456);
    child.setSize(100, 200);
    MockGraphics graphics = new MockGraphics();

    job.paintChildren(panel, graphics);

    assertEquals(new Box(12, 34, 56, 78), graphics.clippedRectangle);
    assertEquals(new Box(123, 456, 100, 200), graphics.subGraphics.get(0).clip);
  }
View Full Code Here

TOP

Related Classes of limelight.util.Box

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.