OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 import unittest | |
5 | |
6 from telemetry import png_bitmap | |
7 | |
8 # This is a simple base64 encoded 2x2 PNG which contains, in order, a single | |
9 # Red, Yellow, Blue, and Green pixel. | |
10 test_png = """ | |
11 iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91 | |
12 JpzAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACx | |
13 MBAJqcGAAAABZJREFUCNdj/M/AwPCfgYGB4T/DfwY | |
14 AHAAD/iOWZXsAAAAASUVORK5CYII= | |
15 """ | |
16 | |
17 class PngBitmapTest(unittest.TestCase): | |
18 def testRead(self): | |
19 png = png_bitmap.PngBitmap(test_png) | |
20 | |
21 self.assertEquals(2, png.width) | |
22 self.assertEquals(2, png.height) | |
23 | |
24 png.GetPixelColor(0, 0).AssertIsRGB(255, 0, 0) | |
25 png.GetPixelColor(1, 1).AssertIsRGB(0, 255, 0) | |
26 png.GetPixelColor(0, 1).AssertIsRGB(0, 0, 255) | |
27 png.GetPixelColor(1, 0).AssertIsRGB(255, 255, 0) | |
OLD | NEW |