|
1 /* |
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @summary test equals method |
|
27 * @bug 7092764 |
|
28 */ |
|
29 |
|
30 import java.awt.font.TransformAttribute; |
|
31 import java.awt.geom.AffineTransform; |
|
32 |
|
33 public class TransformEqualityTest { |
|
34 |
|
35 public static void main(String[] args) { |
|
36 AffineTransform tx1 = new AffineTransform(1, 0, 1, 1, 0, 0); |
|
37 AffineTransform tx2 = new AffineTransform(1, 0, 1, 1, 0, 0); |
|
38 AffineTransform tx3 = new AffineTransform(2, 0, 1, 1, 0, 0); |
|
39 TransformAttribute ta1a = new TransformAttribute(tx1); |
|
40 TransformAttribute ta1b = new TransformAttribute(tx1); |
|
41 TransformAttribute ta2 = new TransformAttribute(tx2); |
|
42 TransformAttribute ta3 = new TransformAttribute(tx3); |
|
43 if (ta1a.equals(null)) { |
|
44 throw new RuntimeException("should not be equal to null."); |
|
45 } |
|
46 if (!ta1a.equals(ta1a)) { |
|
47 throw new RuntimeException("(1) should be equal."); |
|
48 } |
|
49 if (!ta1a.equals(ta1b)) { |
|
50 throw new RuntimeException("(2) should be equal."); |
|
51 } |
|
52 if (!ta1a.equals(ta2)) { |
|
53 throw new RuntimeException("(3) should be equal."); |
|
54 } |
|
55 if (ta2.equals(ta3)) { |
|
56 throw new RuntimeException("should be different."); |
|
57 } |
|
58 } |
|
59 } |
|
60 |