001: /* ========================================================================
002: * JCommon : a free general purpose class library for the Java(tm) platform
003: * ========================================================================
004: *
005: * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
006: *
007: * Project Info: http://www.jfree.org/jcommon/index.html
008: *
009: * This library is free software; you can redistribute it and/or modify it
010: * under the terms of the GNU Lesser General Public License as published by
011: * the Free Software Foundation; either version 2.1 of the License, or
012: * (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but
015: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017: * License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022: * USA.
023: *
024: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025: * in the United States and other countries.]
026: *
027: * ------------------------
028: * PaintUtilitiesTests.java
029: * ------------------------
030: * (C) Copyright 2005, by Object Refinery Limited.
031: *
032: * Original Author: David Gilbert (for Object Refinery Limited);
033: * Contributor(s): -;
034: *
035: * $Id: PaintUtilitiesTests.java,v 1.2 2005/10/18 13:25:14 mungady Exp $
036: *
037: * Changes
038: * -------
039: * 23-Feb-2005 : Version 1 (DG);
040: *
041: */
042:
043: package org.jfree.util.junit;
044:
045: import java.awt.Color;
046: import java.awt.GradientPaint;
047: import java.awt.Paint;
048:
049: import junit.framework.Test;
050: import junit.framework.TestCase;
051: import junit.framework.TestSuite;
052:
053: import org.jfree.util.PaintUtilities;
054:
055: /**
056: * Some tests for the {@link PaintUtilities} class.
057: */
058: public class PaintUtilitiesTests extends TestCase {
059:
060: /**
061: * Returns the tests as a test suite.
062: *
063: * @return The test suite.
064: */
065: public static Test suite() {
066: return new TestSuite(PaintUtilitiesTests.class);
067: }
068:
069: /**
070: * Constructs a new set of tests.
071: *
072: * @param name the name of the tests.
073: */
074: public PaintUtilitiesTests(String name) {
075: super (name);
076: }
077:
078: /**
079: * Some checks for the equal(Paint, Paint) method.
080: */
081: public void testEqual() {
082: Paint p1 = Color.red;
083: Paint p2 = Color.blue;
084: Paint p3 = new Color(1, 2, 3, 4);
085: Paint p4 = new Color(1, 2, 3, 4);
086: Paint p5 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
087: Color.yellow);
088: Paint p6 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
089: Color.yellow);
090: Paint p7 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
091: Color.blue);
092: assertTrue(PaintUtilities.equal(null, null));
093: assertFalse(PaintUtilities.equal(p1, null));
094: assertFalse(PaintUtilities.equal(null, p1));
095: assertFalse(PaintUtilities.equal(p1, p2));
096: assertTrue(PaintUtilities.equal(p3, p3));
097: assertTrue(PaintUtilities.equal(p3, p4));
098: assertTrue(PaintUtilities.equal(p5, p6));
099: assertFalse(PaintUtilities.equal(p5, p7));
100: }
101:
102: }
|