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 webkitpy.thirdparty.unittest2 as unittest | 26 import unittest |
| 27 |
27 from png import PNGChecker | 28 from png import PNGChecker |
28 from webkitpy.common.system.filesystem_mock import MockFileSystem | 29 from webkitpy.common.system.filesystem_mock import MockFileSystem |
29 from webkitpy.common.system.systemhost_mock import MockSystemHost | 30 from webkitpy.common.system.systemhost_mock import MockSystemHost |
30 | 31 |
31 | 32 |
32 class MockSCMDetector(object): | 33 class MockSCMDetector(object): |
33 | 34 |
34 def __init__(self, scm, prop=None): | 35 def __init__(self, scm, prop=None): |
35 self._scm = scm | 36 self._scm = scm |
36 self._prop = prop | 37 self._prop = prop |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 self.assertEqual(len(errors), 1) | 123 self.assertEqual(len(errors), 1) |
123 | 124 |
124 file_path = "foo-expected.png" | 125 file_path = "foo-expected.png" |
125 fs.write_binary_file(file_path, "Dummy binary data") | 126 fs.write_binary_file(file_path, "Dummy binary data") |
126 scm = MockSCMDetector('git') | 127 scm = MockSCMDetector('git') |
127 errors = [] | 128 errors = [] |
128 checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystem
Host(os_name='linux', filesystem=fs)) | 129 checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystem
Host(os_name='linux', filesystem=fs)) |
129 checker.check() | 130 checker.check() |
130 self.assertEqual(len(errors), 2) | 131 self.assertEqual(len(errors), 2) |
131 self.assertEqual(errors[0], (0, 'image/png', 5, 'Image lacks a checksum.
Generate pngs using run-webkit-tests to ensure they have a checksum.')) | 132 self.assertEqual(errors[0], (0, 'image/png', 5, 'Image lacks a checksum.
Generate pngs using run-webkit-tests to ensure they have a checksum.')) |
OLD | NEW |