https://bugs.webkit.org/show_bug.cgi?id=87881
Reviewed by Tony Chang.
* PrettyPatch/PrettyPatch.rb:
* PrettyPatch/PrettyPatch_test.rb:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119010
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-05-30 Ojan Vafai <ojan@chromium.org>
+
+ Only include the image checksum error in pretty-diffs for -expected.png files.
+ https://bugs.webkit.org/show_bug.cgi?id=87881
+
+ Reviewed by Tony Chang.
+
+ * PrettyPatch/PrettyPatch.rb:
+ * PrettyPatch/PrettyPatch_test.rb:
+
2012-05-29 Ojan Vafai <ojan@chromium.org>
Show an error in the pretty diff when an image lacks a checksum
Websites
]
- IMAGE_CHECKSUM_ERROR = "<p>INVALID: Image lacks a checksum. This will fail with a MISSING error in run-webkit-tests. Always generate new png files using run-webkit-tests.</p>"
+ IMAGE_CHECKSUM_ERROR = "INVALID: Image lacks a checksum. This will fail with a MISSING error in run-webkit-tests. Always generate new png files using run-webkit-tests."
def self.normalize_line_ending(s)
s.gsub /\r\n?/, "\n"
if not @image_url then
return "<span class='text'>Image file removed</span>"
end
- image_snippet = "<img class='image' src='" + @image_url + "' />"
- if not @image_checksum then
- return IMAGE_CHECKSUM_ERROR + image_snippet
+
+ image_checksum = ""
+ if @image_checksum
+ image_checksum = @image_checksum
+ elsif @filename.include? "-expected.png"
+ image_checksum = IMAGE_CHECKSUM_ERROR
end
- return "<p>" + @image_checksum + "</p>" + image_snippet
+
+ return "<p>" + image_checksum + "</p><img class='image' src='" + @image_url + "' />"
end
def to_html
str += "<p class=\"#{style}\">"
if image_checksum
- str += image_checksum + "<br>"
- else
- str += IMAGE_CHECKSUM_ERROR + "<br>"
+ str += image_checksum
+ elsif @filename.include? "-expected.png"
+ str += IMAGE_CHECKSUM_ERROR
end
+
+ str += "<br>"
+
if image_url
str += "<img class='image' src='" + image_url + "' />"
else
def test_images_without_checksum
pretty = check_one_patch(144064, ["Images without checksums", 10, 5, 4, 8])
- puts pretty
matches = pretty.match("INVALID: Image lacks a checksum.")
assert(matches, "Should have invalid checksums")
# FIXME: This should only have 4 invalid images, but git apply needs an actual copy of the before binary
# thought to have no checksum, instead of the 4 images that actually don't have a checksum.
assert_equal(10, pretty.scan(/INVALID\: Image lacks a checksum\./).size)
end
+
+ def test_images_correctly_without_checksum_git
+ pretty = check_one_patch(101620, ["Images correctly without checksums git", 7, 15, 10, 26])
+ matches = pretty.match("INVALID: Image lacks a checksum.")
+ assert(!matches, "Png should lack a checksum without an error.")
+ end
+
+ def test_images_correctly_without_checksum_svn
+ pretty = check_one_patch(31202, ["Images correctly without checksums svn", 4, 4, 1, 4])
+ matches = pretty.match("INVALID: Image lacks a checksum.")
+ assert(!matches, "Png should lack a checksum without an error.")
+ end
+
end