Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 874 lines (818 sloc) 27.849 kb
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
b1a2d1b @tomayac Restructured unit tests to run from local file system.
authored
5 <link rel="stylesheet" href="./test_resources/qunit.css" type="text/css"/>
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
6 <script src="./mediafragments.js"></script>
b1a2d1b @tomayac Restructured unit tests to run from local file system.
authored
7 <script src="./test_resources/jquery.js"></script>
8 <script type="text/javascript" src="./test_resources/qunit.js"></script>
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
9 <script type="text/javascript">
10 $(document).ready(function(){
11 var uri = 'http://example.com/example.webm';
12
13 module("Media Fragments URI - Query Part Unit Tests");
1f34479 @tomayac Safari does not support ISO 8601 dates. Handling this now.
authored
14
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
15 test("Valid simple temporal test npt (seconds)", function() {
16 expect(1);
17 var should = {
18 t: [
19 {
20 value: '1,10',
21 unit: 'npt',
22 end: '10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
23 start: '1',
24 startNormalized: 1,
25 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
26 }
27 ]
28 };
29 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=1,10').query;
30 deepEqual(is, should, '');
31 });
32
33 test("Valid simple temporal test npt (seconds, milliseconds)", function() {
34 expect(1);
35 var should = {
36 t: [
37 {
38 value: '1.000,10.000',
39 unit: 'npt',
40 end: '10.000',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
41 start: '1.000',
42 startNormalized: 1,
43 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
44 }
45 ]
46 };
47 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=1.000,10.000').query;
48 deepEqual(is, should, '');
49 });
50
51 test("Valid simple temporal test npt (minutes, seconds)", function() {
52 expect(1);
53 var should = {
54 t: [
55 {
56 value: '00:01,00:10',
57 unit: 'npt',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
58 end: '00:10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
59 start: '00:01',
60 startNormalized: 1,
61 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
62 }
63 ]
64 };
65 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=00:01,00:10').query;
66 deepEqual(is, should, '');
67 });
68
69 test("Valid simple temporal test npt (minutes, seconds, milliseconds)", function() {
70 expect(1);
71 var should = {
72 t: [
73 {
74 value: '00:01.000,00:10.000',
75 unit: 'npt',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
76 end: '00:10.000',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
77 start: '00:01.000',
78 startNormalized: 1,
79 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
80 }
81 ]
82 };
83 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=00:01.000,00:10.000').query;
84 deepEqual(is, should, '');
85 });
86
87
88 test("Valid simple temporal test npt (hours, minutes, seconds)",
89 function() {
90 expect(1);
91 var should = {
92 t: [
93 {
94 value: '00:00:01,00:00:10',
95 unit: 'npt',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
96 end: '00:00:10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
97 start: '00:00:01',
98 startNormalized: 1,
99 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
100 }
101 ]
102 };
103 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=00:00:01,00:00:10').query;
104 deepEqual(is, should, '');
105 });
106
107 test("Valid simple temporal test npt (hours, minutes, seconds, milliseconds)",
108 function() {
109 expect(1);
110 var should = {
111 t: [
112 {
113 value: '00:00:01.000,00:00:10.000',
114 unit: 'npt',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
115 end: '00:00:10.000',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
116 start: '00:00:01.000',
117 startNormalized: 1,
118 endNormalized: 10,
119 startNormalized: 1
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
120 }
121 ]
122 };
123 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=00:00:01.000,00:00:10.000').query;
124 deepEqual(is, should, '');
125 });
126
127 test("Valid simple temporal test smpte", function() {
128 expect(1);
129 var should = {
130 t: [
131 {
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
132 value: 'smpte-30:0:02:00,0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
133 unit: 'smpte-30',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
134 end: '0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
135 start: '0:02:00'
136 }
137 ]
138 };
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
139 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=smpte-30:0:02:00,0:02:01:00.15').query;
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
140 deepEqual(is, should, '');
141 });
142
143 test("Valid simple temporal test clock", function() {
144 expect(1);
145 var should = {
146 t: [
147 {
148 value: 'clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z',
149 unit: 'clock',
150 end: '2009-07-26T11:20:01Z',
151 start: '2009-07-26T11:19:01Z'
152 }
153 ]
154 };
155 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z').query;
156 deepEqual(is, should, '');
157 });
158
159 test("Valid simple temporal test, only start parameter npt", function() {
160 expect(1);
161 var should = {
162 t: [
163 {
164 value: '1',
165 unit: 'npt',
166 end: '',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
167 start: '1',
168 startNormalized: 1,
169 endNormalized: ''
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
170 }
171 ]
172 };
173 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=1').query;
174 deepEqual(is, should, '');
175 });
176
177 test("Valid simple temporal test, only start parameter smpte", function() {
178 expect(1);
179 var should = {
180 t: [
181 {
182 value: 'smpte-30:0:02:00',
183 unit: 'smpte-30',
184 end: '',
185 start: '0:02:00'
186 }
187 ]
188 };
189 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=smpte-30:0:02:00').query;
190 deepEqual(is, should, '');
191 });
192
193 test("Valid simple temporal test, only start parameter clock", function() {
194 expect(1);
195 var should = {
196 t: [
197 {
198 value: 'clock:2009-07-26T11:19:01Z',
199 unit: 'clock',
200 end: '',
201 start: '2009-07-26T11:19:01Z'
202 }
203 ]
204 };
205 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=clock:2009-07-26T11:19:01Z').query;
206 deepEqual(is, should, '');
207 });
208
209 test("Valid simple temporal test, only end parameter npt", function() {
210 expect(1);
211 var should = {
212 t: [
213 {
214 value: ',1',
215 unit: 'npt',
216 end: '1',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
217 start: '',
218 startNormalized: '',
219 endNormalized: 1
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
220 }
221 ]
222 };
223 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=,1').query;
224 deepEqual(is, should, '');
225 });
226
227 test("Valid simple temporal test, only end parameter smpte", function() {
228 expect(1);
229 var should = {
230 t: [
231 {
232 value: 'smpte-30:,0:02:00',
233 unit: 'smpte-30',
234 end: '0:02:00',
235 start: ''
236 }
237 ]
238 };
239 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=smpte-30:,0:02:00').query;
240 deepEqual(is, should, '');
241 });
242
243 test("Valid simple temporal test, only end parameter clock", function() {
244 expect(1);
245 var should = {
246 t: [
247 {
248 value: 'clock:,2009-07-26T11:19:01Z',
249 unit: 'clock',
250 end: '2009-07-26T11:19:01Z',
251 start: ''
252 }
253 ]
254 };
255 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=clock:,2009-07-26T11:19:01Z').query;
256 deepEqual(is, should, '');
257 });
258
259 test("Invalid negative start temporal", function() {
260 expect(1);
261 var should = {};
262 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=-1,1').query;
263 deepEqual(is, should, '');
264 });
265
266 test("Invalid start > end temporal (seconds)", function() {
267 expect(1);
268 var should = {};
269 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=10,1').query;
270 deepEqual(is, should, '');
271 });
272
273 test("Invalid start > end temporal (seconds, milliseconds)", function() {
274 expect(1);
275 var should = {};
276 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=10.000,1.000').query;
277 deepEqual(is, should, '');
278 });
279
280 test("Invalid start > end temporal (hours, minutes, seconds, milliseconds)", function() {
281 expect(1);
282 var should = {};
283 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=00:00:10.000,00:00:01.000').query;
284 deepEqual(is, should, '');
285 });
286
287 test("Valid simple spatial test", function() {
288 expect(1);
289 var should = {
290 xywh: [
291 {
292 value: '10,10,10,10',
293 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
294 x: 10,
295 y: 10,
296 w: 10,
297 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
298 }
299 ]
300 };
301 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=10,10,10,10').query;
302 deepEqual(is, should, '');
303 });
304
305 test("Valid simple spatial test, pixel", function() {
306 expect(1);
307 var should = {
308 xywh: [
309 {
310 value: 'pixel:10,10,10,10',
311 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
312 x: 10,
313 y: 10,
314 w: 10,
315 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
316 }
317 ]
318 };
319 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=pixel:10,10,10,10').query;
320 deepEqual(is, should, '');
321 });
322
323 test("Valid simple spatial test, percent", function() {
324 expect(1);
325 var should = {
326 xywh: [
327 {
328 value: 'percent:10,10,10,10',
329 unit: 'percent',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
330 x: 10,
331 y: 10,
332 w: 10,
333 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
334 }
335 ]
336 };
337 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=percent:10,10,10,10').query;
338 deepEqual(is, should, '');
339 });
340
341 test("Invalid simple spatial test", function() {
342 expect(1);
343 var should = {};
344 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=-10,10,10,10').query;
345 deepEqual(is, should, '');
346 });
347
348 test("Invalid simple spatial test, negative x, pixel", function() {
349 expect(1);
350 var should = {};
351 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=pixel:-10,10,10,10').query;
352 deepEqual(is, should, '');
353 });
354
355 test("Invalid simple spatial test, negative x, percent", function() {
356 expect(1);
357 var should = {};
358 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=percent:-10,10,10,10').query;
359 deepEqual(is, should, '');
360 });
361
362 test("Invalid simple spatial test, percent value > 100, percent", function() {
363 expect(1);
364 var should = {};
365 var is = MediaFragments.parseMediaFragmentsUri(uri + '?xywh=percent:101,10,10,10').query;
366 deepEqual(is, should, '');
367 });
368
369 test("Valid simple temporal test npt, xywh", function() {
370 expect(1);
371 var should = {
372 t: [
373 {
374 value: '1,10',
375 unit: 'npt',
376 end: '10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
377 start: '1',
378 startNormalized: 1,
379 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
380 }
381 ],
382 xywh: [
383 {
384 value: '10,10,10,10',
385 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
386 x: 10,
387 y: 10,
388 w: 10,
389 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
390 }
391 ]
392 };
393 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=1,10&xywh=10,10,10,10').query;
394 deepEqual(is, should, '');
395 });
396
397 test("Valid simple temporal test smpte, xywh", function() {
398 expect(1);
399 var should = {
400 t: [
401 {
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
402 value: 'smpte-30:0:02:00,0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
403 unit: 'smpte-30',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
404 end: '0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
405 start: '0:02:00'
406 }
407 ],
408 xywh: [
409 {
410 value: '10,10,10,10',
411 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
412 x: 10,
413 y: 10,
414 w: 10,
415 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
416 }
417 ]
418 };
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
419 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=smpte-30:0:02:00,0:02:01:00.15&xywh=10,10,10,10').query;
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
420 deepEqual(is, should, '');
421 });
422
423 test("Valid simple temporal test clock, xywh", function() {
424 expect(1);
425 var should = {
426 t: [
427 {
428 value: 'clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z',
429 unit: 'clock',
430 end: '2009-07-26T11:20:01Z',
431 start: '2009-07-26T11:19:01Z'
432 }
433 ],
434 xywh: [
435 {
436 value: '10,10,10,10',
437 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
438 x: 10,
439 y: 10,
440 w: 10,
441 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
442 }
443 ]
444 };
445 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z&xywh=10,10,10,10').query;
446 deepEqual(is, should, '');
447 });
448
449 module("Media Fragments URI - Hash Part Unit Tests");
450
451 test("Valid simple temporal test npt", function() {
452 expect(1);
453 var should = {
454 t: [
455 {
456 value: '1,10',
457 unit: 'npt',
458 end: '10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
459 start: '1',
460 startNormalized: 1,
461 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
462 }
463 ]
464 };
465 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=1,10').hash;
466 deepEqual(is, should, '');
467 });
468
469 test("Valid simple temporal test smpte", function() {
470 expect(1);
471 var should = {
472 t: [
473 {
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
474 value: 'smpte-30:0:02:00,0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
475 unit: 'smpte-30',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
476 end: '0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
477 start: '0:02:00'
478 }
479 ]
480 };
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
481 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=smpte-30:0:02:00,0:02:01:00.15').hash;
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
482 deepEqual(is, should, '');
483 });
484
485 test("Valid simple temporal test clock", function() {
486 expect(1);
487 var should = {
488 t: [
489 {
490 value: 'clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z',
491 unit: 'clock',
492 end: '2009-07-26T11:20:01Z',
493 start: '2009-07-26T11:19:01Z'
494 }
495 ]
496 };
497 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z').hash;
498 deepEqual(is, should, '');
499 });
500
501 test("Valid simple temporal test, only start parameter npt", function() {
502 expect(1);
503 var should = {
504 t: [
505 {
506 value: '1',
507 unit: 'npt',
508 end: '',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
509 start: '1',
510 startNormalized: 1,
511 endNormalized: ''
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
512 }
513 ]
514 };
515 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=1').hash;
516 deepEqual(is, should, '');
517 });
518
519 test("Valid simple temporal test, only start parameter smpte", function() {
520 expect(1);
521 var should = {
522 t: [
523 {
524 value: 'smpte-30:0:02:00',
525 unit: 'smpte-30',
526 end: '',
527 start: '0:02:00'
528 }
529 ]
530 };
531 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=smpte-30:0:02:00').hash;
532 deepEqual(is, should, '');
533 });
534
535 test("Valid simple temporal test, only start parameter clock", function() {
536 expect(1);
537 var should = {
538 t: [
539 {
540 value: 'clock:2009-07-26T11:19:01Z',
541 unit: 'clock',
542 end: '',
543 start: '2009-07-26T11:19:01Z'
544 }
545 ]
546 };
547 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=clock:2009-07-26T11:19:01Z').hash;
548 deepEqual(is, should, '');
549 });
550
551 test("Valid simple temporal test, only end parameter npt", function() {
552 expect(1);
553 var should = {
554 t: [
555 {
556 value: ',1',
557 unit: 'npt',
558 end: '1',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
559 start: '',
560 endNormalized: 1,
561 startNormalized: ''
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
562 }
563 ]
564 };
565 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=,1').hash;
566 deepEqual(is, should, '');
567 });
568
569 test("Valid simple temporal test, only end parameter smpte", function() {
570 expect(1);
571 var should = {
572 t: [
573 {
574 value: 'smpte-30:,0:02:00',
575 unit: 'smpte-30',
576 end: '0:02:00',
577 start: ''
578 }
579 ]
580 };
581 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=smpte-30:,0:02:00').hash;
582 deepEqual(is, should, '');
583 });
584
585 test("Valid simple temporal test, only end parameter clock", function() {
586 expect(1);
587 var should = {
588 t: [
589 {
590 value: 'clock:,2009-07-26T11:19:01Z',
591 unit: 'clock',
592 end: '2009-07-26T11:19:01Z',
593 start: ''
594 }
595 ]
596 };
597 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=clock:,2009-07-26T11:19:01Z').hash;
598 deepEqual(is, should, '');
599 });
600
601 test("Invalid negative start temporal", function() {
602 expect(1);
603 var should = {};
604 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=-1,1').hash;
605 deepEqual(is, should, '');
606 });
607
608 test("Valid simple spatial test", function() {
609 expect(1);
610 var should = {
611 xywh: [
612 {
613 value: '10,10,10,10',
614 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
615 x: 10,
616 y: 10,
617 w: 10,
618 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
619 }
620 ]
621 };
622 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=10,10,10,10').hash;
623 deepEqual(is, should, '');
624 });
625
626 test("Valid simple spatial test, pixel", function() {
627 expect(1);
628 var should = {
629 xywh: [
630 {
631 value: 'pixel:10,10,10,10',
632 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
633 x: 10,
634 y: 10,
635 w: 10,
636 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
637 }
638 ]
639 };
640 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=pixel:10,10,10,10').hash;
641 deepEqual(is, should, '');
642 });
643
644 test("Valid simple spatial test, percent", function() {
645 expect(1);
646 var should = {
647 xywh: [
648 {
649 value: 'percent:10,10,10,10',
650 unit: 'percent',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
651 x: 10,
652 y: 10,
653 w: 10,
654 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
655 }
656 ]
657 };
658 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=percent:10,10,10,10').hash;
659 deepEqual(is, should, '');
660 });
661
662 test("Invalid simple spatial test", function() {
663 expect(1);
664 var should = {};
665 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=-10,10,10,10').hash;
666 deepEqual(is, should, '');
667 });
668
669 test("Invalid simple spatial test, negative x, pixel", function() {
670 expect(1);
671 var should = {};
672 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=pixel:-10,10,10,10').hash;
673 deepEqual(is, should, '');
674 });
675
676 test("Invalid simple spatial test, negative x, percent", function() {
677 expect(1);
678 var should = {};
679 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=percent:-10,10,10,10').hash;
680 deepEqual(is, should, '');
681 });
682
683 test("Invalid simple spatial test, percent value > 100, percent", function() {
684 expect(1);
685 var should = {};
686 var is = MediaFragments.parseMediaFragmentsUri(uri + '#xywh=percent:101,10,10,10').hash;
687 deepEqual(is, should, '');
688 });
689
690 test("Valid simple temporal test npt, xywh", function() {
691 expect(1);
692 var should = {
693 t: [
694 {
695 value: '1,10',
696 unit: 'npt',
697 end: '10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
698 start: '1',
699 startNormalized: 1,
700 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
701 }
702 ],
703 xywh: [
704 {
705 value: '10,10,10,10',
706 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
707 x: 10,
708 y: 10,
709 w: 10,
710 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
711 }
712 ]
713 };
714 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=1,10&xywh=10,10,10,10').hash;
715 deepEqual(is, should, '');
716 });
717
718 test("Valid simple temporal test smpte, xywh", function() {
719 expect(1);
720 var should = {
721 t: [
722 {
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
723 value: 'smpte-30:0:02:00,0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
724 unit: 'smpte-30',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
725 end: '0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
726 start: '0:02:00'
727 }
728 ],
729 xywh: [
730 {
731 value: '10,10,10,10',
732 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
733 x: 10,
734 y: 10,
735 w: 10,
736 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
737 }
738 ]
739 };
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
740 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=smpte-30:0:02:00,0:02:01:00.15&xywh=10,10,10,10').hash;
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
741 deepEqual(is, should, '');
742 });
743
744 test("Valid simple temporal test clock, xywh", function() {
745 expect(1);
746 var should = {
747 t: [
748 {
749 value: 'clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z',
750 unit: 'clock',
751 end: '2009-07-26T11:20:01Z',
752 start: '2009-07-26T11:19:01Z'
753 }
754 ],
755 xywh: [
756 {
757 value: '10,10,10,10',
758 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
759 x: 10,
760 y: 10,
761 w: 10,
762 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
763 }
764 ]
765 };
766 var is = MediaFragments.parseMediaFragmentsUri(uri + '#t=clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z&xywh=10,10,10,10').hash;
767 deepEqual(is, should, '');
768 });
769
770 module("Media Fragments URI - Query & Hash Part Unit Tests");
771
772 test("Valid simple temporal test npt (query), xywh (hash)", function() {
773 expect(2);
774 var should = {
775 t: [
776 {
777 value: '1,10',
778 unit: 'npt',
779 end: '10',
ad391d9 @tomayac Updated unit tests. Fixed a tiny bug with {start,end}Normalized.
authored
780 start: '1',
781 startNormalized: 1,
782 endNormalized: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
783 }
784 ]
785 };
786 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=1,10#xywh=10,10,10,10').query;
787 deepEqual(is, should, '');
788 var should = {
789 xywh: [
790 {
791 value: '10,10,10,10',
792 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
793 x: 10,
794 y: 10,
795 w: 10,
796 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
797 }
798 ]
799 };
800 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=1,10#xywh=10,10,10,10').hash;
801 deepEqual(is, should, '');
802 });
803
804 test("Valid simple temporal test smpte (query), xywh (hash)", function() {
805 expect(2);
806 var should = {
807 t: [
808 {
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
809 value: 'smpte-30:0:02:00,0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
810 unit: 'smpte-30',
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
811 end: '0:02:01:00.15',
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
812 start: '0:02:00'
813 }
814 ]
815 };
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
816 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=smpte-30:0:02:00,0:02:01:00.15#xywh=10,10,10,10').query;
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
817 deepEqual(is, should, '');
818 var should = {
819 xywh: [
820 {
821 value: '10,10,10,10',
822 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
823 x: 10,
824 y: 10,
825 w: 10,
826 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
827 }
828 ]
829 };
c08d311 @tomayac Bug fix with trailing dots in NPT. Start < End check in SMPTE. Code opti...
authored
830 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=smpte-30:0:02:00,0:02:01:00.15#xywh=10,10,10,10').hash;
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
831 deepEqual(is, should, '');
832 });
833
834 test("Valid simple temporal test clock (query), xywh (hash)", function() {
835 expect(2);
836 var should = {
837 t: [
838 {
839 value: 'clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z',
840 unit: 'clock',
841 end: '2009-07-26T11:20:01Z',
842 start: '2009-07-26T11:19:01Z'
843 }
844 ]
845 };
846 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z#xywh=10,10,10,10').query;
847 deepEqual(is, should, '');
848 var should = {
849 xywh: [
850 {
851 value: '10,10,10,10',
852 unit: 'pixel',
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
853 x: 10,
854 y: 10,
855 w: 10,
856 h: 10
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
857 }
858 ]
859 };
860 var is = MediaFragments.parseMediaFragmentsUri(uri + '?t=clock:2009-07-26T11:19:01Z,2009-07-26T11:20:01Z#xywh=10,10,10,10').hash;
861 deepEqual(is, should, '');
1f34479 @tomayac Safari does not support ISO 8601 dates. Handling this now.
authored
862 });
863 });
9a762b9 @tomayac Added unit tests based on the QUnit framework
authored
864 </script>
865 </head>
866 <body>
867 <h1 id="qunit-header">QUnit example</h1>
868 <h2 id="qunit-banner"></h2>
869 <h2 id="qunit-userAgent"></h2>
870 <ol id="qunit-tests">
871 </ol>
872 </body>
367504d @pasqLisena updated tests (xywh are integer now)
pasqLisena authored
873 </html>
Something went wrong with that request. Please try again.