OLD | NEW |
1 # Copyright (C) 2012 Balazs Ankes (bank@inf.u-szeged.hu) University of Szeged | 1 # Copyright (C) 2012 Balazs Ankes (bank@inf.u-szeged.hu) University of Szeged |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
5 # are met: | 5 # are met: |
6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
11 # | 11 # |
12 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 12 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
13 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 13 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
14 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 14 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
15 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 15 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
16 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 16 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
17 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 17 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
18 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 18 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
19 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 19 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
20 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | 23 |
24 """Unit test for png.py.""" | 24 """Unit test for png.py.""" |
25 | 25 |
26 import unittest | 26 import unittest |
27 | 27 |
28 from png import PNGChecker | 28 from png import PNGChecker |
29 from webkitpy.common.system.filesystem_mock import MockFileSystem | 29 from webkitpy.common.system.filesystem_mock import MockFileSystem |
30 from webkitpy.common.system.systemhost_mock import MockSystemHost | 30 from webkitpy.common.system.system_host_mock import MockSystemHost |
31 | 31 |
32 | 32 |
33 class PNGCheckerTest(unittest.TestCase): | 33 class PNGCheckerTest(unittest.TestCase): |
34 """Tests PNGChecker class.""" | 34 """Tests PNGChecker class.""" |
35 | 35 |
36 def test_init(self): | 36 def test_init(self): |
37 """Test __init__() method.""" | 37 """Test __init__() method.""" |
38 | 38 |
39 def mock_handle_style_error(self): | 39 def mock_handle_style_error(self): |
40 pass | 40 pass |
(...skipping 20 matching lines...) Expand all Loading... |
61 | 61 |
62 file_path = "foo-expected.png" | 62 file_path = "foo-expected.png" |
63 fs.write_binary_file(file_path, "Dummy binary data") | 63 fs.write_binary_file(file_path, "Dummy binary data") |
64 errors = [] | 64 errors = [] |
65 checker = PNGChecker(file_path, mock_handle_style_error, MockSystemHost(
os_name='linux', filesystem=fs)) | 65 checker = PNGChecker(file_path, mock_handle_style_error, MockSystemHost(
os_name='linux', filesystem=fs)) |
66 checker.check() | 66 checker.check() |
67 self.assertEqual(len(errors), 1) | 67 self.assertEqual(len(errors), 1) |
68 self.assertEqual( | 68 self.assertEqual( |
69 errors[0], | 69 errors[0], |
70 (0, 'image/png', 5, 'Image lacks a checksum. Generate pngs using run
-webkit-tests to ensure they have a checksum.')) | 70 (0, 'image/png', 5, 'Image lacks a checksum. Generate pngs using run
-webkit-tests to ensure they have a checksum.')) |
OLD | NEW |