Java 8 DebugGraphics - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DebugGraphics class.

This code example shows how to use the following methods:
        JLabel label = new JLabel();
        BirdsEyeView birdEye = new BirdsEyeView(label, new Dimension(100, 100),
                new Point(100, 100));
        label.setSize(400, 400);
        birdEye.setSize(100, 50);
        DebugGraphics g = new DebugGraphics();
        birdEye.paintComponent(g);
        double zoomFactor = 50 * 1.0 / 400;
        assertTrue("The zoom factor should be same with expected.", Helper.compareDoubles(zoomFactor,
                birdEye.getViewPort().getZoomFactor()));
        assertEquals("The size of the view port should be same with expected.",
                new Dimension((int) (zoomFactor * 100), (int) (zoomFactor * 100)),
                birdEye.getViewPort().getSize());
    } 
    /** 
     * <p> 
     * Test case of the paintComponent method. 
     * </p> 
     */ 
    public void testPaintComponentWithZeroHeight() { 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * IllegalArgumentException is expected. 
     * </p> 
     */ 
    public void testPaintComponentFailWithNotGraphics() { 
        try { 
            zoomPane.paintComponent(new DebugGraphics());
        } catch (IllegalArgumentException e) {
            // expected 
        } 
    } 
 
    /** 
     * Test of paintComponent for accuracy with a transformer of noZoom. 
     * 
     * @throws Exception when error occurs 
     */ 
    public void testPaintComponentAccuracyWithNoZoom() throws Exception {
        // the transformer is of no zoom by default 
        DemoController demoController = new DemoController();
        zoomPane = new ZoomPane(new CoordinateArea(demoController), new AffineZoomTransform(1.0));
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * It tests the case that when p1 is null and expects IllegalArgumentException. 
     * </p> 
     */ 
    public void testPaint_NullP1() { 
        try { 
            lineStyle.paint(new DebugGraphics(), null, new Point(13, 10));
            fail("IllegalArgumentException expected.");
        } catch (IllegalArgumentException iae) {
            //good 
        } 
    } 
 
    /** 
     * <p> 
     * Tests LineStyle#paint(Graphics,Point,Point) for failure. 
     * </p> 
     * 
     * <p> 
     * It tests the case that when p2 is null and expects IllegalArgumentException. 
     * </p> 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * g is of wrong type, IllegalArgumentException is expected. 
     * </p> 
     */ 
    public void testPaintComponentGraphicsWrongType() { 
        try { 
            zoomPane.paintComponent(new DebugGraphics());
            fail("g is of wrong type, IllegalArgumentException is expected.");
        } catch (IllegalArgumentException e) {
            // expect 
        } 
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    /** 
     * Test of paint(Graphics, Point, Point) for IllegalArgumentException. 
     */ 
    public void testPaintForException_NullPoint1() { 
        try { 
            instance.paint(new DebugGraphics(), null, new Point());
            // should not be here 
            fail("IllegalArgumentException expected.");
        } catch (IllegalArgumentException e) {
            // should be here 
        } 
    } 
 
    /** 
     * Test of paint(Graphics, Point, Point) for IllegalArgumentException. 
     */ 
    public void testPaintForException_NullPoint2() { 
        try { 
            instance.paint(new DebugGraphics(), new Point(), null);
            // should not be here 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    /** 
     * Test of paint(Graphics, Point, Point) for IllegalArgumentException. 
     */ 
    public void testPaintForException_NullPoint1() { 
        try { 
            instance.paint(new DebugGraphics(), null, new Point());
            // should not be here 
            fail("IllegalArgumentException expected.");
        } catch (IllegalArgumentException e) {
            // should be here 
        } 
    } 
 
    /** 
     * Test of paint(Graphics, Point, Point) for IllegalArgumentException. 
     */ 
    public void testPaintForException_NullPoint2() { 
        try { 
            instance.paint(new DebugGraphics(), new Point(), null);
            // should not be here 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * @throws Exception 
     *             if any error occurred when set up 
     */ 
    public void testRenderGrid_NullDiagramView() throws Exception {
        try { 
            renderer.renderGrid(new DebugGraphics(), null);
            fail("Expect IllegalArgumentException.");
        } catch (IllegalArgumentException iae) {
            // expect 
        } 
    } 
 
    /** 
     * Tests the method setGridSize(int) with zero gridSize, expected IllegalArgumentException. 
     * 
     * @throws Exception 
     *             if any error occurred when set up 
     */ 
    public void testSetGridSize_ZeroGridSize() throws Exception {
        try { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 DebugGraphics Methods: