Home | History | Annotate | Download | only in base
      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 
      9 base.unittest.testSuite('base.bbox2', function() {
     10   test('addVec2', function() {
     11     var bbox = new base.BBox2();
     12     var x = vec2.create();
     13     vec2.set(x, 10, 10);
     14     bbox.addVec2(x);
     15     assertTrue(bbox.minVec2[0] == 10);
     16     assertTrue(bbox.minVec2[1] == 10);
     17     assertTrue(bbox.maxVec2[0] == 10);
     18     assertTrue(bbox.maxVec2[1] == 10);
     19     // Mutate x.
     20     vec2.set(x, 11, 11);
     21 
     22     // Bbox shouldn't have changed.
     23     assertTrue(bbox.minVec2[0] == 10);
     24     assertTrue(bbox.minVec2[1] == 10);
     25     assertTrue(bbox.maxVec2[0] == 10);
     26     assertTrue(bbox.maxVec2[1] == 10);
     27   });
     28 });
     29