| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 # | 2 # |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 | 7 |
| 8 # DESCRIPTION : | 8 # DESCRIPTION : |
| 9 # | 9 # |
| 10 # This is a factory test to test the LEDs (wifi, battery, etc). | 10 # This is a factory test to test the LEDs (wifi, battery, etc). |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 def register_callbacks(self, window): | 171 def register_callbacks(self, window): |
| 172 window.connect('key-release-event', self.key_release_callback) | 172 window.connect('key-release-event', self.key_release_callback) |
| 173 window.add_events(gdk.KEY_RELEASE_MASK) | 173 window.add_events(gdk.KEY_RELEASE_MASK) |
| 174 | 174 |
| 175 def run_once(self, led_ctl_path=None): | 175 def run_once(self, led_ctl_path=None): |
| 176 | 176 |
| 177 factory.log('%s run_once' % self.__class__) | 177 factory.log('%s run_once' % self.__class__) |
| 178 | 178 |
| 179 self._led_ctl_path = led_ctl_path | 179 self._led_ctl_path = led_ctl_path |
| 180 if not os.path.exists(self._led_ctl_path): |
| 181 raise error.TestNAError('Command %s does not exist' % |
| 182 self._led_ctl_path) |
| 180 | 183 |
| 181 self._shift_color = ful.BLACK | 184 self._shift_color = ful.BLACK |
| 182 self._shift_cnt = 0 | 185 self._shift_cnt = 0 |
| 183 | 186 |
| 184 os.chdir(self.srcdir) | 187 os.chdir(self.srcdir) |
| 185 image = cairo.ImageSurface.create_from_png('leds.png') | 188 try: |
| 189 image = cairo.ImageSurface.create_from_png('leds.png') |
| 190 except cairo.Error as e: |
| 191 raise error.TestNAError('Error while opening leds.png: %s' % |
| 192 e.message) |
| 186 image_size = (image.get_width(), image.get_height()) | 193 image_size = (image.get_width(), image.get_height()) |
| 187 self._leds_image = image | 194 self._leds_image = image |
| 188 | 195 |
| 189 image = cairo.ImageSurface.create_from_png('shf.png') | 196 image = cairo.ImageSurface.create_from_png('shf.png') |
| 190 self._shf_image = image | 197 self._shf_image = image |
| 191 | 198 |
| 192 self._pattern_queue = [x for x in reversed(_PATTERN_LIST)] | 199 self._pattern_queue = [x for x in reversed(_PATTERN_LIST)] |
| 193 self._status_map = dict((n, ful.UNTESTED) for n, f in _PATTERN_LIST) | 200 self._status_map = dict((n, ful.UNTESTED) for n, f in _PATTERN_LIST) |
| 194 | 201 |
| 195 pattern_da = gtk.DrawingArea() | 202 pattern_da = gtk.DrawingArea() |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 cleanup_callback=self.quit) | 235 cleanup_callback=self.quit) |
| 229 | 236 |
| 230 failed_set = set(name for name, status in self._status_map.items() | 237 failed_set = set(name for name, status in self._status_map.items() |
| 231 if status is not ful.PASSED) | 238 if status is not ful.PASSED) |
| 232 if failed_set: | 239 if failed_set: |
| 233 raise error.TestFail('Some patterns failed\n' \ | 240 raise error.TestFail('Some patterns failed\n' \ |
| 234 '以下圖樣測試未通過: %s' % | 241 '以下圖樣測試未通過: %s' % |
| 235 ', '.join(failed_set)) | 242 ', '.join(failed_set)) |
| 236 | 243 |
| 237 factory.log('%s run_once finished' % self.__class__) | 244 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |