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

Side by Side Diff: tools/cc-frame-viewer/src/quad_view_viewport_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_viewport.js ('k') | tools/cc-frame-viewer/src/tests.html » ('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('base.bbox2');
13 base.require('quad_view_viewport');
14 </script>
15 </head>
16 <body>
17 <script>
18 'use strict';
19
20 var QuadViewViewport = ccfv.QuadViewViewport;
21
22 function testBasicsHighDPI() {
23 var bbox = new base.BBox2();
24 bbox.addXY(0, 0);
25 bbox.addXY(4000, 2000);
26
27 var vp = new QuadViewViewport(bbox, 0.125, true, 2);
28 assertEquals(500, vp.deviceWidth);
29 assertEquals(250, vp.deviceHeight);
30
31 assertEquals(250, vp.layoutWidth);
32 assertEquals(125, vp.layoutHeight);
33
34 // Top left.
35 var tmp = vp.layoutPixelsToWorldPixels2(vec2.createXY(0, 0))
36 assertEquals(0, tmp[0]);
37 assertEquals(0, tmp[1]);
38
39 // World center.
40 var tmp = vp.layoutPixelsToWorldPixels2(vec2.createXY(125, 62.5))
41 assertEquals(2000, tmp[0]);
42 assertEquals(1000, tmp[1]);
43
44 // Bottom right.
45 var tmp = vp.layoutPixelsToWorldPixels2(vec2.createXY(250, 125))
46 assertEquals(4000, tmp[0]);
47 assertEquals(2000, tmp[1]);
48 }
49
50 function testBasicsHighDPIUnpadded() {
51 var bbox = new base.BBox2();
52 bbox.addXY(0, 0);
53 bbox.addXY(4000, 2000);
54
55 var vp = new QuadViewViewport(bbox, 0.125, false, 2);
56 assertEquals(550, vp.deviceWidth);
57 assertEquals(300, vp.deviceHeight);
58
59 assertEquals(275, vp.layoutWidth);
60 assertEquals(150, vp.layoutHeight);
61
62 // Top left.
63 var tmp = vp.layoutPixelsToWorldPixels2(vec2.createXY(0, 0))
64 assertEquals(-200, tmp[0]);
65 assertEquals(-200, tmp[1]);
66
67 // World center.
68 var tmp = vp.layoutPixelsToWorldPixels2(vec2.createXY(137.5, 75))
69 assertEquals(2000, tmp[0]);
70 assertEquals(1000, tmp[1]);
71
72 // Bottom right.
73 var tmp = vp.layoutPixelsToWorldPixels2(vec2.createXY(275, 150))
74 assertEquals(4200, tmp[0]);
75 assertEquals(2200, tmp[1]);
76 }
77 </script>
78 </body>
79 </html>
OLDNEW
« no previous file with comments | « tools/cc-frame-viewer/src/quad_view_viewport.js ('k') | tools/cc-frame-viewer/src/tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698