Skip to content

Commit 1272368

Browse files
committed
8318113: CSS.BackgroundImage doesn't implement equals
Reviewed-by: aivanov, tr, prr
1 parent 28d3762 commit 1272368

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/java.desktop/share/classes/javax/swing/text/html/CSS.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,6 +2965,17 @@ ImageIcon getImage(URL base) {
29652965
}
29662966
return image;
29672967
}
2968+
2969+
@Override
2970+
public int hashCode() {
2971+
return Objects.hashCode(svalue);
2972+
}
2973+
2974+
@Override
2975+
public boolean equals(Object val) {
2976+
return val instanceof CSS.BackgroundImage img
2977+
&& Objects.equals(svalue, img.svalue);
2978+
}
29682979
}
29692980

29702981
/**

test/jdk/javax/swing/text/html/CSS/CSSAttributeEqualityBug.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
/*
3333
* @test
34-
* @bug 7083187
34+
* @bug 7083187 8318113
3535
* @summary Verifies if CSS.CSSValue attribute is same
3636
* @run main CSSAttributeEqualityBug
3737
*/
@@ -72,6 +72,9 @@ public class CSSAttributeEqualityBug {
7272
"background-position: 1em 2em",
7373

7474
"border-width: medium",
75+
76+
"background-image: none",
77+
"background-image: url(image.png)",
7578
};
7679

7780
/**
@@ -86,6 +89,8 @@ public class CSSAttributeEqualityBug {
8689
{"margin-top: 42px", "margin-top: 22px"},
8790
{"margin-top: 42px", "margin-top: 42pt"},
8891
{"margin-top: 100%", "margin-top: 50%"},
92+
93+
{"background-image: none", "background-image: url(image.png)"},
8994
};
9095

9196
private static final String[][] EQUALS_WITH_SPACE = {

0 commit comments

Comments
 (0)