summaryrefslogtreecommitdiff
path: root/chromium/third_party/trace-viewer/src/base/rect_test.js
blob: e8f4cc0f6f6948a8503391f7240923f993a22a80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (c) 2013 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.

'use strict';

base.require('base.rect');

base.unittest.testSuite('base.rect', function() {
  test('UVRectBasic', function() {
    var container = base.Rect.fromXYWH(0, 0, 10, 10);
    var inner = base.Rect.fromXYWH(1, 1, 8, 8);
    var uv = inner.asUVRectInside(container);
    assertRectEquals(uv, base.Rect.fromXYWH(0.1, 0.1, .8, .8));
    assertEquals(container.size().width, 10);
    assertEquals(container.size().height, 10);
  });
});