1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>SReview javascript tests</title>
<link rel="stylesheet" href="/usr/share/javascript/qunit/qunit.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="/usr/share/javascript/qunit/qunit.js"></script>
<script>
sreview_viddata = {
"corrvals": {
"length_adj": -6.5,
"offset_start": 30.2,
},
"mainlen": 2700,
"prelen": 1200,
"postlen": 1000,
};
</script>
<script src="../web/public/mangler.js"></script>
<script>
let sv = sreview_viddata;
QUnit.test("current values", function(assert) {
assert.ok(sv.lengths['pre'] === 1200, "pre length initializes correctly");
assert.ok(sv.lengths['main_initial'] === 2700, "main length initializes correctly");
assert.ok(sv.lengths['post'] === 1000, "post length initializes correctly");
});
QUnit.test("immediate calculations", function(assert) {
assert.ok(sv.point_to_abs('pre', 300) === 300, "point in pre view computes correctly");
assert.ok(sv.point_to_abs('main', 300) === 1200 + 30.2 + 300, "point in main video computes correctly");
assert.ok(sv.point_to_abs('post', 300) === 1200 + 30.2 + 2700 - 6.5 + 300, "point in post video computes correctly");
});
</script>
</body>
</html>
|