8318113: CSS.BackgroundImage doesn't implement equals

Reviewed-by: aivanov, tr, prr
This commit is contained in:
Prasanta Sadhukhan 2023-11-27 09:01:22 +00:00
parent 28d3762bd3
commit 12723688ca
2 changed files with 17 additions and 1 deletions

View File

@ -2965,6 +2965,17 @@ public class CSS implements Serializable {
} }
return image; return image;
} }
@Override
public int hashCode() {
return Objects.hashCode(svalue);
}
@Override
public boolean equals(Object val) {
return val instanceof CSS.BackgroundImage img
&& Objects.equals(svalue, img.svalue);
}
} }
/** /**

View File

@ -31,7 +31,7 @@ import javax.swing.text.html.StyleSheet;
/* /*
* @test * @test
* @bug 7083187 * @bug 7083187 8318113
* @summary Verifies if CSS.CSSValue attribute is same * @summary Verifies if CSS.CSSValue attribute is same
* @run main CSSAttributeEqualityBug * @run main CSSAttributeEqualityBug
*/ */
@ -72,6 +72,9 @@ public class CSSAttributeEqualityBug {
"background-position: 1em 2em", "background-position: 1em 2em",
"border-width: medium", "border-width: medium",
"background-image: none",
"background-image: url(image.png)",
}; };
/** /**
@ -86,6 +89,8 @@ public class CSSAttributeEqualityBug {
{"margin-top: 42px", "margin-top: 22px"}, {"margin-top: 42px", "margin-top: 22px"},
{"margin-top: 42px", "margin-top: 42pt"}, {"margin-top: 42px", "margin-top: 42pt"},
{"margin-top: 100%", "margin-top: 50%"}, {"margin-top: 100%", "margin-top: 50%"},
{"background-image: none", "background-image: url(image.png)"},
}; };
private static final String[][] EQUALS_WITH_SPACE = { private static final String[][] EQUALS_WITH_SPACE = {