Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8318113: CSS.BackgroundImage doesn't implement equals #16613

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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);
}
}

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

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

"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: 42pt"},
{"margin-top: 100%", "margin-top: 50%"},

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

private static final String[][] EQUALS_WITH_SPACE = {