| Tests DataCue interface |
| |
| |
| *** Test DataCue's TextTrackCue interface. |
| EXPECTED (cue instanceof 'function TextTrackCue() { [native code] }') OK |
| EXPECTED (cue.track == 'null') OK |
| EXPECTED (cue.id == '') OK |
| EXPECTED (cue.startTime == '3') OK |
| EXPECTED (cue.endTime == '10') OK |
| EXPECTED (cue.pauseOnExit == 'false') OK |
| |
| *** Test DataCue interface. |
| EXPECTED (cue instanceof 'function DataCue() { [native code] }') OK |
| EXPECTED (new Uint8Array(cue.data).length == '5') OK |
| EXPECTED (new Uint8Array(cue.data)[0] == '4') OK |
| EXPECTED (new Uint8Array(cue.data)[1] == '5') OK |
| EXPECTED (new Uint8Array(cue.data)[2] == '2') OK |
| EXPECTED (new Uint8Array(cue.data)[3] == '1') OK |
| EXPECTED (new Uint8Array(cue.data)[4] == '9') OK |
| |
| *** Changing the original buffer data should not effect DataCue.data. |
| RUN(expectedData[0] = 7) |
| EXPECTED (new Uint8Array(cue.data)[0] == '4') OK |
| RUN(cue.data = expectedData.buffer) |
| EXPECTED (new Uint8Array(cue.data)[0] == '7') OK |
| RUN(expectedData[0] = 11) |
| EXPECTED (new Uint8Array(cue.data)[0] == '7') OK |
| RUN(new Uint8Array(cue.data)[0] = 8) |
| EXPECTED ((new Uint8Array(cue.data))[0] == '7') OK |
| |
| *** Throw exception if data is not an ArrayBuffer. |
| TEST(cue.data = null) THROWS('TypeError: The DataCue.data attribute must be an instance of ArrayBuffer') OK |
| TEST(cue.data = 'test') THROWS('TypeError: The DataCue.data attribute must be an instance of ArrayBuffer') OK |
| TEST(cue.data = [5]) THROWS('TypeError: The DataCue.data attribute must be an instance of ArrayBuffer') OK |
| |
| *** Constructor with value argument. |
| EXPECTED (new DataCue(1, 2, null).value === 'null') OK |
| EXPECTED (new DataCue(1, 2, 'test').value === 'test') OK |
| EXPECTED (new DataCue(1, 2, [5]).value.length == '1') OK |
| EXPECTED (new DataCue(1, 2, [5]).value[0] == '5') OK |
| |
| *** Test adding DataCue to track with kind = 'metadata'. |
| EXPECTED (cue.track == '[object TextTrack]') OK |
| EXPECTED (metadataTrack.cues[0] == '[object DataCue]') OK |
| |
| *** Test adding DataCue to track with kind != 'metadata'. |
| TEST(track.addCue(cue)) THROWS(DOMException.INVALID_NODE_TYPE_ERR) OK |
| EXPECTED (track.cues.length == '0') OK |
| TEST(track.addCue(cue)) THROWS(DOMException.INVALID_NODE_TYPE_ERR) OK |
| EXPECTED (track.cues.length == '0') OK |
| TEST(track.addCue(cue)) THROWS(DOMException.INVALID_NODE_TYPE_ERR) OK |
| EXPECTED (track.cues.length == '0') OK |
| TEST(track.addCue(cue)) THROWS(DOMException.INVALID_NODE_TYPE_ERR) OK |
| EXPECTED (track.cues.length == '0') OK |
| END OF TEST |
| |