Index: tools/telemetry/telemetry/core/bitmap_unittest.py |
diff --git a/tools/telemetry/telemetry/core/bitmap_unittest.py b/tools/telemetry/telemetry/core/bitmap_unittest.py |
index 45dd14fdcf4d18216ff5cca238b159dcb0bb144c..4d37e1490ad98b7337aa61d2439a6495d2d844a4 100644 |
--- a/tools/telemetry/telemetry/core/bitmap_unittest.py |
+++ b/tools/telemetry/telemetry/core/bitmap_unittest.py |
@@ -2,8 +2,9 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import unittest |
+import tempfile |
import os |
+import unittest |
from telemetry.core import bitmap |
from telemetry.core import util |
@@ -35,7 +36,7 @@ class BitmapTest(unittest.TestCase): |
bmp.GetPixelColor(0, 1).AssertIsRGB(0, 0, 255) |
bmp.GetPixelColor(1, 0).AssertIsRGB(255, 255, 0) |
- def testReadFromPnfFile(self): |
+ def testReadFromPngFile(self): |
file_bmp = bitmap.Bitmap.FromPngFile(test_png_path) |
self.assertEquals(2, file_bmp.width) |
@@ -46,6 +47,13 @@ class BitmapTest(unittest.TestCase): |
file_bmp.GetPixelColor(0, 1).AssertIsRGB(0, 0, 255) |
file_bmp.GetPixelColor(1, 0).AssertIsRGB(255, 255, 0) |
+ def testWritePngFile(self): |
+ orig = bitmap.Bitmap.FromPngFile(test_png_path) |
+ temp_file = tempfile.NamedTemporaryFile().name |
+ orig.WritePngFile(temp_file) |
+ new_file = bitmap.Bitmap.FromPngFile(temp_file) |
+ self.assertTrue(orig.IsEqual(new_file)) |
+ |
def testIsEqual(self): |
bmp = bitmap.Bitmap.FromBase64Png(test_png) |
file_bmp = bitmap.Bitmap.FromPngFile(test_png_path) |