| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <link rel="import" href="/tracing/base/rect.html"> | 7 <link rel="import" href="/tracing/base/math/rect.html"> |
| 8 <script> | 8 <script> |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| 11 tr.b.unittest.testSuite(function() { | 11 tr.b.unittest.testSuite(function() { |
| 12 test('UVRectBasic', function() { | 12 test('UVRectBasic', function() { |
| 13 function assertRectEquals(a, b, opt_message) { | 13 function assertRectEquals(a, b, opt_message) { |
| 14 var ok = true; | 14 var ok = true; |
| 15 if (a.x === b.x && a.y === b.y && | 15 if (a.x === b.x && a.y === b.y && |
| 16 a.width === b.width && a.height === b.height) { | 16 a.width === b.width && a.height === b.height) { |
| 17 return; | 17 return; |
| 18 } | 18 } |
| 19 var message = opt_message || 'Expected "' + a.toString() + | 19 var message = opt_message || 'Expected "' + a.toString() + |
| 20 '", got "' + b.toString() + '"'; | 20 '", got "' + b.toString() + '"'; |
| 21 assert.fail(a, b, message); | 21 assert.fail(a, b, message); |
| 22 } | 22 } |
| 23 var container = tr.b.Rect.fromXYWH(0, 0, 10, 10); | 23 var container = tr.b.math.Rect.fromXYWH(0, 0, 10, 10); |
| 24 var inner = tr.b.Rect.fromXYWH(1, 1, 8, 8); | 24 var inner = tr.b.math.Rect.fromXYWH(1, 1, 8, 8); |
| 25 var uv = inner.asUVRectInside(container); | 25 var uv = inner.asUVRectInside(container); |
| 26 assertRectEquals(uv, tr.b.Rect.fromXYWH(0.1, 0.1, .8, .8)); | 26 assertRectEquals(uv, tr.b.math.Rect.fromXYWH(0.1, 0.1, .8, .8)); |
| 27 assert.equal(10, container.size().width); | 27 assert.equal(10, container.size().width); |
| 28 assert.equal(10, container.size().height); | 28 assert.equal(10, container.size().height); |
| 29 }); | 29 }); |
| 30 }); | 30 }); |
| 31 </script> | 31 </script> |
| OLD | NEW |