Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Assert that our PNG images are 64x64 px

`shipit.png` is 75 px for some reason, though.
  • Loading branch information...
commit c5ee5ebb29270661d0bce95f158fadc73f5863c1 1 parent 2b26bb9
@mislav mislav authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/integrity_test.rb
View
20 test/integrity_test.rb
@@ -31,6 +31,21 @@ class IntegrityTest < TestCase
end
end
+ test "images on disk are 64x64" do
+ mismatches = []
+ Dir["#{Emoji.images_path}/**/*.png"].each do |image_file|
+ width, height = png_dimensions(image_file)
+ unless width == 64 && height == 64
+ mismatches << "%s: %dx%d" % [
+ image_file.sub(Emoji.images_path, ''),
+ width,
+ height
+ ]
+ end
+ end
+ assert_equal ["/emoji/shipit.png: 75x75"], mismatches
+ end
+
test "missing or incorrect unicodes" do
missing = source_unicode_emoji - Emoji.all.map(&:raw).compact
assert_equal 0, missing.size, missing_unicodes_message(missing)
@@ -58,4 +73,9 @@ def db
def source_unicode_emoji
@source_unicode_emoji ||= db["EmojiDataArray"].flat_map { |data| data["CVCategoryData"]["Data"].split(",") }
end
+
+ def png_dimensions(file)
+ png = File.open(file, "rb") { |f| f.read(1024) }
+ png.unpack("x16N2")
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.