Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: tools/cc-frame-viewer/src/quad_view_test.html

Issue 15736032: Remove old cc-frame-viewer now that it is upstreamed into trace_viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/cc-frame-viewer/src/quad_view.js ('k') | tools/cc-frame-viewer/src/quad_view_viewport.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
7 -->
8 <head>
9 <script src="base.js"></script>
10 <script>
11 base.require('base.unittest');
12 base.require('model.layer_tree_host_impl');
13 base.require('quad_view');
14 base.require('quad_view_viewport');
15 </script>
16 </head>
17 <body>
18 <script>
19 'use strict';
20
21 var QuadView = ccfv.QuadView;
22 var QuadViewViewport = ccfv.QuadViewViewport;
23
24 function QuadFromXYWH(x, y, w, h) {
25 return {p1: {x: x, y: y},
26 p2: {x: x+w, y: y},
27 p3: {x: x+w, y: y+h},
28 p4: {x: x, y: y+h}};
29 }
30
31 function testInstantiate() {
32 var quadView = new QuadView();
33 this.addHTMLOutput('test', quadView);
34
35 var quads = [
36 QuadFromXYWH(0, 0, 10, 10),
37 QuadFromXYWH(10, 10, 10, 10),
38 QuadFromXYWH(20, 4, 10, 10),
39 QuadFromXYWH(30, 10, 20, 20),
40 QuadFromXYWH(20, 20, 10, 10),
41 QuadFromXYWH(15, 15, 10, 10)
42 ];
43 quads[2].selected = true;
44 var quadsBBox = new base.BBox2();
45 for (var i = 0; i < quads.length; i++)
46 quadsBBox.addQuad(quads[i]);
47
48 quadView.title = 'Test Tree';
49 quadView.quads = quads;
50 quadView.viewport = new QuadViewViewport(quadsBBox, 10.0)
51 quadView.deviceViewportSizeForFrame = {widht: 50,
52 height: 30};
53 }
54
55 function testFindTiles() {
56 var quadView = new QuadView();
57
58 var quads = [
59 QuadFromXYWH(0, 0, 10, 10),
60 QuadFromXYWH(10, 10, 10, 10),
61 QuadFromXYWH(20, 4, 10, 10),
62 QuadFromXYWH(30, 10, 20, 20),
63 QuadFromXYWH(20, 20, 10, 10),
64 QuadFromXYWH(15, 15, 10, 10)
65 ];
66 var quadsBBox = new base.BBox2();
67 for (var i = 0; i < quads.length; i++)
68 quadsBBox.addQuad(quads[i]);
69
70 quadView.title = 'Test Tree';
71 quadView.quads = quads;
72 quadView.viewport = new QuadViewViewport(quadsBBox, 10.0, true, 2);
73 quadView.deviceViewportSizeForFrame = {widht: 50,
74 height: 30};
75
76 document.body.appendChild(quadView);
77 try {
78 var rect = quadView.canvas_.getBoundingClientRect();
79 var hitIndices = quadView.findQuadsAtCanvasClientPoint(rect.left + 75,
80 rect.top + 75);
81 } finally {
82 document.body.removeChild(quadView);
83 }
84
85 assertEquals(2, hitIndices.length);
86 assertArrayEquals(hitIndices, [1, 5]);
87 }
88
89 </script>
90 </body>
91 </html>
OLDNEW
« no previous file with comments | « tools/cc-frame-viewer/src/quad_view.js ('k') | tools/cc-frame-viewer/src/quad_view_viewport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698