| 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. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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.systemhost_mock import MockSystemHost |
| 31 | 31 |
| 32 | 32 |
| 33 class PNGCheckerTest(unittest.TestCase): | 33 class PNGCheckerTest(unittest.TestCase): |
| 34 |
| 34 """Tests PNGChecker class.""" | 35 """Tests PNGChecker class.""" |
| 35 | 36 |
| 36 def test_init(self): | 37 def test_init(self): |
| 37 """Test __init__() method.""" | 38 """Test __init__() method.""" |
| 38 | 39 |
| 39 def mock_handle_style_error(self): | 40 def mock_handle_style_error(self): |
| 40 pass | 41 pass |
| 41 | 42 |
| 42 checker = PNGChecker("test/config", mock_handle_style_error, MockSystemH
ost()) | 43 checker = PNGChecker("test/config", mock_handle_style_error, MockSystemH
ost()) |
| 43 self.assertEqual(checker._file_path, "test/config") | 44 self.assertEqual(checker._file_path, "test/config") |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 self.assertEqual(len(errors), 0) | 61 self.assertEqual(len(errors), 0) |
| 61 | 62 |
| 62 file_path = "foo-expected.png" | 63 file_path = "foo-expected.png" |
| 63 fs.write_binary_file(file_path, "Dummy binary data") | 64 fs.write_binary_file(file_path, "Dummy binary data") |
| 64 errors = [] | 65 errors = [] |
| 65 checker = PNGChecker(file_path, mock_handle_style_error, MockSystemHost(
os_name='linux', filesystem=fs)) | 66 checker = PNGChecker(file_path, mock_handle_style_error, MockSystemHost(
os_name='linux', filesystem=fs)) |
| 66 checker.check() | 67 checker.check() |
| 67 self.assertEqual(len(errors), 1) | 68 self.assertEqual(len(errors), 1) |
| 68 self.assertEqual(errors[0], (0, 'image/png', 5, | 69 self.assertEqual(errors[0], (0, 'image/png', 5, |
| 69 'Image lacks a checksum. Generate pngs usin
g run-webkit-tests to ensure they have a checksum.')) | 70 'Image lacks a checksum. Generate pngs usin
g run-webkit-tests to ensure they have a checksum.')) |
| OLD | NEW |