Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / base / ui / camera_test.html
1 <!DOCTYPE html>
2 <!--
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
5 found in the LICENSE file.
6 -->
7 <link rel="import" href="/base/rect.html">
8 <link rel="import" href="/base/quad.html">
9 <link rel="import" href="/base/bbox2.html">
10 <link rel="import" href="/base/ui/quad_stack_view.html">
11 <script>
12 'use strict';
13
14 tv.unittest.testSuite(function() {
15
16   function createQuads() {
17     var quads = [
18       tv.Quad.fromXYWH(-500, -500, 30, 30), // 4 corners
19       tv.Quad.fromXYWH(-500, 470, 30, 30),
20       tv.Quad.fromXYWH(470, -500, 30, 30),
21       tv.Quad.fromXYWH(470, 470, 30, 30),
22       tv.Quad.fromXYWH(-250, -250, 250, 250), // crosshairs
23       tv.Quad.fromXYWH(0, -250, 250, 250), // crosshairs
24       tv.Quad.fromXYWH(-250, 0, 250, 250), // crosshairs
25       tv.Quad.fromXYWH(0, 0, 250, 250) // crosshairs
26     ];
27     quads[0].stackingGroupId = 0;
28     quads[1].stackingGroupId = 0;
29     quads[2].stackingGroupId = 0;
30     quads[3].stackingGroupId = 0;
31     quads[4].stackingGroupId = 1;
32     quads[5].stackingGroupId = 1;
33     quads[6].stackingGroupId = 1;
34     quads[7].stackingGroupId = 1;
35     return quads;
36   }
37
38   function createQuadStackView(testFramework) {
39     var quads = createQuads();
40     var view = new tv.ui.QuadStackView();
41     // simulate the constraints of the layer-tree-view
42     view.style.height = '400px';
43     view.style.width = '800px';
44     view.deviceRect = tv.Rect.fromXYWH(-250, -250, 500, 500);
45     view.quads = quads;
46
47     testFramework.addHTMLOutput(view);
48     return view;
49   }
50
51   test('initialState', function() {
52     var view = createQuadStackView(this);
53
54     var viewRect =
55         view.getBoundingClientRect();
56     assertEquals(400, viewRect.height);
57     assertEquals(800, viewRect.width);
58   });
59 });
60 </script>