OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 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 |
| 5 import optparse |
| 6 import webkitpy.thirdparty.unittest2 as unittest |
| 7 |
| 8 from webkitpy.layout_tests.controllers import repaint_overlay |
| 9 |
| 10 |
| 11 EXPECTED_TEXT = """ |
| 12 (GraphicsLayer |
| 13 (bounds 800.00 600.00) |
| 14 (children 1 |
| 15 (GraphicsLayer |
| 16 (bounds 800.00 600.00) |
| 17 (contentsOpaque 1) |
| 18 (drawsContent 1) |
| 19 (repaint rects |
| 20 (rect 8.00 108.00 100.00 100.00) |
| 21 (rect 0.00 216.00 800.00 100.00) |
| 22 ) |
| 23 ) |
| 24 ) |
| 25 ) |
| 26 """ |
| 27 |
| 28 ACTUAL_TEXT = """ |
| 29 (GraphicsLayer |
| 30 (bounds 800.00 600.00) |
| 31 (children 1 |
| 32 (GraphicsLayer |
| 33 (bounds 800.00 600.00) |
| 34 (contentsOpaque 1) |
| 35 (drawsContent 1) |
| 36 (repaint rects |
| 37 (rect 0.00 216.00 800.00 100.00) |
| 38 ) |
| 39 ) |
| 40 ) |
| 41 ) |
| 42 """ |
| 43 |
| 44 |
| 45 class TestRepaintOverlay(unittest.TestCase): |
| 46 def test_result_contains_repaint_rects(self): |
| 47 self.assertTrue(repaint_overlay.result_contains_repaint_rects(EXPECTED_T
EXT)) |
| 48 self.assertTrue(repaint_overlay.result_contains_repaint_rects(ACTUAL_TEX
T)) |
| 49 self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD')) |
| 50 |
| 51 def test_generate_repaint_overlay_html(self): |
| 52 html = repaint_overlay.generate_repaint_overlay_html('test', ACTUAL_TEXT
, EXPECTED_TEXT) |
| 53 self.assertNotEqual(-1, html.find('expected_rects = [[8.00,108.00,100.00
,100.00],[0.00,216.00,800.00,100.00]];')) |
| 54 self.assertNotEqual(-1, html.find('actual_rects = [[0.00,216.00,800.00,1
00.00]];')) |
OLD | NEW |