blob: 71dfba8f4420809877a31ffd234ed34a1f20f5d3 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/base/rect.html">
<link rel="import" href="/base/quad.html">
<link rel="import" href="/base/bbox2.html">
<link rel="import" href="/base/ui/quad_stack_view.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
function createQuads() {
var quads = [
tr.b.Quad.fromXYWH(-500, -500, 30, 30), // 4 corners
tr.b.Quad.fromXYWH(-500, 470, 30, 30),
tr.b.Quad.fromXYWH(470, -500, 30, 30),
tr.b.Quad.fromXYWH(470, 470, 30, 30),
tr.b.Quad.fromXYWH(-250, -250, 250, 250), // crosshairs
tr.b.Quad.fromXYWH(0, -250, 250, 250), // crosshairs
tr.b.Quad.fromXYWH(-250, 0, 250, 250), // crosshairs
tr.b.Quad.fromXYWH(0, 0, 250, 250) // crosshairs
];
quads[0].stackingGroupId = 0;
quads[1].stackingGroupId = 0;
quads[2].stackingGroupId = 0;
quads[3].stackingGroupId = 0;
quads[4].stackingGroupId = 1;
quads[5].stackingGroupId = 1;
quads[6].stackingGroupId = 1;
quads[7].stackingGroupId = 1;
return quads;
}
function createQuadStackView(testFramework) {
var quads = createQuads();
var view = new tr.b.ui.QuadStackView();
// simulate the constraints of the layer-tree-view
view.style.height = '400px';
view.style.width = '800px';
view.deviceRect = tr.b.Rect.fromXYWH(-250, -250, 500, 500);
view.quads = quads;
testFramework.addHTMLOutput(view);
return view;
}
test('initialState', function() {
var view = createQuadStackView(this);
var viewRect =
view.getBoundingClientRect();
assert.equal(viewRect.height, 400);
assert.equal(viewRect.width, 800);
});
});
</script>