Skip to content

Commit

Permalink
8318113: CSS.BackgroundImage doesn't implement equals
Browse files Browse the repository at this point in the history
Reviewed-by: aivanov, tr, prr
  • Loading branch information
prsadhuk committed Nov 27, 2023
1 parent 28d3762 commit 1272368
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/java.desktop/share/classes/javax/swing/text/html/CSS.java
Original file line number Diff line number Diff line change
Expand Up @@ -2965,6 +2965,17 @@ ImageIcon getImage(URL base) {
}
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);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

/*
* @test
* @bug 7083187
* @bug 7083187 8318113
* @summary Verifies if CSS.CSSValue attribute is same
* @run main CSSAttributeEqualityBug
*/
Expand Down Expand Up @@ -72,6 +72,9 @@ public class CSSAttributeEqualityBug {
"background-position: 1em 2em",

"border-width: medium",

"background-image: none",
"background-image: url(image.png)",
};

/**
Expand All @@ -86,6 +89,8 @@ public class CSSAttributeEqualityBug {
{"margin-top: 42px", "margin-top: 22px"},
{"margin-top: 42px", "margin-top: 42pt"},
{"margin-top: 100%", "margin-top: 50%"},

{"background-image: none", "background-image: url(image.png)"},
};

private static final String[][] EQUALS_WITH_SPACE = {
Expand Down

0 comments on commit 1272368

Please sign in to comment.