1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 'use strict'; 6 7 base.require('base.bbox2'); 8 base.require('base.quad'); 9 base.require('ui.quad_stack'); 10 base.require('ui.quad_view_viewport'); 11 base.require('ui.rect_view'); 12 13 base.unittest.testSuite('ui.rect_view', function() { 14 15 test('rect_size', function() { 16 var quads = [ 17 base.Quad.FromXYWH(100, 100, 300, 400), 18 base.Quad.FromXYWH(100, 100, 100, 100) 19 ]; 20 quads[0].stackingGroupId = 0; 21 quads[1].stackingGroupId = 1; 22 23 var quadsBbox = new base.BBox2(); 24 quads.forEach(function(quad) { quadsBbox.addQuad(quad); }); 25 26 var stack = new ui.QuadStack(); 27 28 var deviceViewportSizeForFrame = {width: 1000, height: 400}; 29 stack.initialize(quadsBbox.asRect(), deviceViewportSizeForFrame); 30 stack.quads = quads; 31 32 this.addHTMLOutput(stack); 33 34 assertEquals('125px', stack.worldViewportRectView.style.width); 35 assertEquals((50 + 36) + 'px', stack.worldViewportRectView.style.height); 36 }); 37 }); 38