| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2015 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. |
| --> |
| |
| <link rel="import" href="/model/location.html"> |
| <link rel="import" href="/core/test_utils.html"> |
| <link rel="import" href="/model/comment_box_annotation.html"> |
| <link rel="import" href="/model/rect_annotation.html"> |
| <link rel="import" href="/model/model.html"> |
| <link rel="import" href="/model/x_marker_annotation.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tr.b.unittest.testSuite(function() { |
| |
| test('rectAnnotation', function() { |
| var fakeYComponents1 = [{stableId: '1.2', yPercentOffset: 0.3}]; |
| var fakeYComponents2 = [{stableId: '1.2', yPercentOffset: 0.9}]; |
| var start = new tr.model.Location(50, fakeYComponents1); |
| var end = new tr.model.Location(100, fakeYComponents2); |
| var rectAnnotation = new tr.model.RectAnnotation(start, end); |
| assert.equal(rectAnnotation.startLocation, start); |
| assert.equal(rectAnnotation.endLocation, end); |
| }); |
| |
| test('xMarkerAnnotation', function() { |
| var xMarkerAnnotation = new tr.model.XMarkerAnnotation(90); |
| assert.equal(xMarkerAnnotation.timestamp, 90); |
| }); |
| |
| test('commentBoxAnnotation', function() { |
| var fakeYComponents = [{stableId: '1.2', yPercentOffset: 0.5}]; |
| var location = new tr.model.Location(120, fakeYComponents); |
| var text = 'abc'; |
| var commentBoxAnnotation = |
| new tr.model.CommentBoxAnnotation(location, text); |
| assert.equal(commentBoxAnnotation.location, location); |
| assert.equal(commentBoxAnnotation.text, text); |
| }); |
| }); |
| </script> |