Java Code Examples for java.awt.image.DirectColorModel#equals()

The following examples show how to use java.awt.image.DirectColorModel#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackedColorModelEqualsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void verifyEquals(DirectColorModel m1,
                                 DirectColorModel m2) {
    if (m1.equals(null)) {
        throw new RuntimeException("equals(null) returns true");
    }
    if (!(m1.equals(m2))) {
        throw new RuntimeException("equals() method is not working"
                + " properly");
    }
    if (!(m2.equals(m1))) {
        throw new RuntimeException("equals() method is not working"
                + " properly");
    }
    if (m1.hashCode() != m2.hashCode()) {
        throw new RuntimeException("HashCode is not same for same"
                + " PackedColorModels");
    }
}
 
Example 2
Source File: PackedColorModelEqualsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void testMaskArrayEquality() {
    /*
     * Test with different maskArray values, since PackedColorModel
     * is abstract we use subclass DirectColorModel.
     */
    DirectColorModel model1 =
        new DirectColorModel(24, 0x00FF0000, 0x0000FF00, 0x000000FF);
    DirectColorModel model2 =
        new DirectColorModel(24, 0x000000FF, 0x0000FF00, 0x00FF0000);
    if (model1.equals(model2)) {
        throw new RuntimeException("equals() method is determining"
                + " ColorMap equality improperly");
    }
    if (model2.equals(model1)) {
        throw new RuntimeException("equals() method is determining"
                + " ColorMap equality improperly");
    }
}