| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 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 | |
| 5 found in the LICENSE file. | |
| 6 --> | |
| 7 <link rel="import" href="/tracing/base/rect.html"> | |
| 8 <script> | |
| 9 'use strict'; | |
| 10 | |
| 11 tr.b.unittest.testSuite(function() { | |
| 12 test('UVRectBasic', function() { | |
| 13 function assertRectEquals(a, b, opt_message) { | |
| 14 var ok = true; | |
| 15 if (a.x === b.x && a.y === b.y && | |
| 16 a.width === b.width && a.height === b.height) { | |
| 17 return; | |
| 18 } | |
| 19 var message = opt_message || 'Expected "' + a.toString() + | |
| 20 '", got "' + b.toString() + '"'; | |
| 21 assert.fail(a, b, message); | |
| 22 } | |
| 23 var container = tr.b.Rect.fromXYWH(0, 0, 10, 10); | |
| 24 var inner = tr.b.Rect.fromXYWH(1, 1, 8, 8); | |
| 25 var uv = inner.asUVRectInside(container); | |
| 26 assertRectEquals(uv, tr.b.Rect.fromXYWH(0.1, 0.1, .8, .8)); | |
| 27 assert.equal(10, container.size().width); | |
| 28 assert.equal(10, container.size().height); | |
| 29 }); | |
| 30 }); | |
| 31 </script> | |
| OLD | NEW |