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.unittest'); 8 base.require('base.bbox2'); 9 base.require('ui.quad_stack'); 10 11 base.unittest.testSuite('ui.quad_stack', function() { 12 test('instantiate', function() { 13 var quads = [ 14 base.Quad.FromXYWH(0, -100, 100, 400), 15 base.Quad.FromXYWH(0, 0, 100, 25), 16 base.Quad.FromXYWH(100, 0, 10, 100) 17 ]; 18 quads[0].stackingGroupId = 0; 19 quads[1].stackingGroupId = 1; 20 quads[2].stackingGroupId = 2; 21 22 var quadsBbox = new base.BBox2(); 23 quads.forEach(function(quad) { quadsBbox.addQuad(quad); }); 24 25 var stack = new ui.QuadStack(); 26 27 var deviceViewportSizeForFrame = {width: 200, height: 100}; 28 stack.initialize(quadsBbox.asRect(), deviceViewportSizeForFrame); 29 stack.quads = quads; 30 stack.style.border = '1px solid black'; 31 32 this.addHTMLOutput(stack); 33 34 assertEquals(stack.worldViewportRect.width, 200); 35 assertEquals(stack.worldViewportRect.height, 100); 36 assertNotUndefined(stack.viewport); 37 }); 38 }); 39