| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium 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 <link rel="import" href="/tracing/base/bbox2.html"> | 7 <link rel="import" href="/tracing/base/math/bbox2.html"> |
| 8 <link rel="import" href="/tracing/base/quad.html"> | 8 <link rel="import" href="/tracing/base/math/quad.html"> |
| 9 <link rel="import" href="/tracing/base/rect.html"> | 9 <link rel="import" href="/tracing/base/math/rect.html"> |
| 10 <link rel="import" href="/tracing/ui/base/quad_stack_view.html"> | 10 <link rel="import" href="/tracing/ui/base/quad_stack_view.html"> |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 tr.b.unittest.testSuite(function() { | 14 tr.b.unittest.testSuite(function() { |
| 15 function createQuads() { | 15 function createQuads() { |
| 16 var quads = [ | 16 var quads = [ |
| 17 tr.b.Quad.fromXYWH(-500, -500, 30, 30), // 4 corners | 17 tr.b.math.Quad.fromXYWH(-500, -500, 30, 30), // 4 corners |
| 18 tr.b.Quad.fromXYWH(-500, 470, 30, 30), | 18 tr.b.math.Quad.fromXYWH(-500, 470, 30, 30), |
| 19 tr.b.Quad.fromXYWH(470, -500, 30, 30), | 19 tr.b.math.Quad.fromXYWH(470, -500, 30, 30), |
| 20 tr.b.Quad.fromXYWH(470, 470, 30, 30), | 20 tr.b.math.Quad.fromXYWH(470, 470, 30, 30), |
| 21 tr.b.Quad.fromXYWH(-250, -250, 250, 250), // crosshairs | 21 tr.b.math.Quad.fromXYWH(-250, -250, 250, 250), // crosshairs |
| 22 tr.b.Quad.fromXYWH(0, -250, 250, 250), // crosshairs | 22 tr.b.math.Quad.fromXYWH(0, -250, 250, 250), // crosshairs |
| 23 tr.b.Quad.fromXYWH(-250, 0, 250, 250), // crosshairs | 23 tr.b.math.Quad.fromXYWH(-250, 0, 250, 250), // crosshairs |
| 24 tr.b.Quad.fromXYWH(0, 0, 250, 250) // crosshairs | 24 tr.b.math.Quad.fromXYWH(0, 0, 250, 250) // crosshairs |
| 25 ]; | 25 ]; |
| 26 quads[0].stackingGroupId = 0; | 26 quads[0].stackingGroupId = 0; |
| 27 quads[1].stackingGroupId = 0; | 27 quads[1].stackingGroupId = 0; |
| 28 quads[2].stackingGroupId = 0; | 28 quads[2].stackingGroupId = 0; |
| 29 quads[3].stackingGroupId = 0; | 29 quads[3].stackingGroupId = 0; |
| 30 quads[4].stackingGroupId = 1; | 30 quads[4].stackingGroupId = 1; |
| 31 quads[5].stackingGroupId = 1; | 31 quads[5].stackingGroupId = 1; |
| 32 quads[6].stackingGroupId = 1; | 32 quads[6].stackingGroupId = 1; |
| 33 quads[7].stackingGroupId = 1; | 33 quads[7].stackingGroupId = 1; |
| 34 return quads; | 34 return quads; |
| 35 } | 35 } |
| 36 | 36 |
| 37 function createQuadStackView(testFramework) { | 37 function createQuadStackView(testFramework) { |
| 38 var quads = createQuads(); | 38 var quads = createQuads(); |
| 39 var view = new tr.ui.b.QuadStackView(); | 39 var view = new tr.ui.b.QuadStackView(); |
| 40 // simulate the constraints of the layer-tree-view | 40 // simulate the constraints of the layer-tree-view |
| 41 view.style.height = '400px'; | 41 view.style.height = '400px'; |
| 42 view.style.width = '800px'; | 42 view.style.width = '800px'; |
| 43 view.deviceRect = tr.b.Rect.fromXYWH(-250, -250, 500, 500); | 43 view.deviceRect = tr.b.math.Rect.fromXYWH(-250, -250, 500, 500); |
| 44 view.quads = quads; | 44 view.quads = quads; |
| 45 | 45 |
| 46 testFramework.addHTMLOutput(view); | 46 testFramework.addHTMLOutput(view); |
| 47 return view; | 47 return view; |
| 48 } | 48 } |
| 49 | 49 |
| 50 test('initialState', function() { | 50 test('initialState', function() { |
| 51 var view = createQuadStackView(this); | 51 var view = createQuadStackView(this); |
| 52 | 52 |
| 53 var viewRect = | 53 var viewRect = |
| 54 view.getBoundingClientRect(); | 54 view.getBoundingClientRect(); |
| 55 assert.equal(viewRect.height, 400); | 55 assert.equal(viewRect.height, 400); |
| 56 assert.equal(viewRect.width, 800); | 56 assert.equal(viewRect.width, 800); |
| 57 }); | 57 }); |
| 58 }); | 58 }); |
| 59 </script> | 59 </script> |
| OLD | NEW |