blob: 51dc5dc45de05469049dc659be8d0579fa16c0a3 [file] [log] [blame]
Tests the constructor and mutation of VTTRegion.
** Test instanceof VTTRegion. **
EXPECTED (region instanceof VTTRegion == 'true') OK
** Test the default indexs of a region. **
EXPECTED (region.track == 'null') OK
EXPECTED (region.scroll == '') OK
EXPECTED (region.viewportAnchorX == '0') OK
EXPECTED (region.viewportAnchorY == '100') OK
EXPECTED (region.regionAnchorX == '0') OK
EXPECTED (region.regionAnchorY == '100') OK
EXPECTED (region.lines == '3') OK
EXPECTED (region.width == '100') OK
** Test that incorrect mutation keeps previous valid values. **
RUN(region.scroll = 'invalid-scroll-value')
SyntaxError: The string did not match the expected pattern.
EXPECTED (region.scroll == '') OK
Invalid percentage value: -1
RUN(region.viewportAnchorX = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.viewportAnchorX == '0') OK
RUN(region.viewportAnchorY = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.viewportAnchorY == '100') OK
RUN(region.regionAnchorX = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.regionAnchorX == '0') OK
RUN(region.regionAnchorY = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.regionAnchorY == '100') OK
RUN(region.width = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.width == '100') OK
Invalid percentage value: 101
RUN(region.viewportAnchorX = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.viewportAnchorX == '0') OK
RUN(region.viewportAnchorY = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.viewportAnchorY == '100') OK
RUN(region.regionAnchorX = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.regionAnchorX == '0') OK
RUN(region.regionAnchorY = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.regionAnchorY == '100') OK
RUN(region.width = invalidPercentageValues[index])
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.width == '100') OK
Invalid percentage value: -Infinity
RUN(region.viewportAnchorX = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.viewportAnchorX == '0') OK
RUN(region.viewportAnchorY = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.viewportAnchorY == '100') OK
RUN(region.regionAnchorX = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.regionAnchorX == '0') OK
RUN(region.regionAnchorY = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.regionAnchorY == '100') OK
RUN(region.width = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.width == '100') OK
Invalid percentage value: Infinity
RUN(region.viewportAnchorX = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.viewportAnchorX == '0') OK
RUN(region.viewportAnchorY = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.viewportAnchorY == '100') OK
RUN(region.regionAnchorX = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.regionAnchorX == '0') OK
RUN(region.regionAnchorY = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.regionAnchorY == '100') OK
RUN(region.width = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.width == '100') OK
Invalid percentage value: NaN
RUN(region.viewportAnchorX = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.viewportAnchorX == '0') OK
RUN(region.viewportAnchorY = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.viewportAnchorY == '100') OK
RUN(region.regionAnchorX = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.regionAnchorX == '0') OK
RUN(region.regionAnchorY = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.regionAnchorY == '100') OK
RUN(region.width = invalidPercentageValues[index])
TypeError: The provided value is non-finite
EXPECTED (region.width == '100') OK
RUN(region.lines = -1)
IndexSizeError: The index is not in the allowed range.
EXPECTED (region.lines == '3') OK
** Test that proper mutation keeps assigned value. **
RUN(region.lines = 130)
EXPECTED (region.lines == '130') OK
RUN(region.viewportAnchorX = 64)
EXPECTED (region.viewportAnchorX == '64') OK
RUN(region.viewportAnchorY = 32)
EXPECTED (region.viewportAnchorY == '32') OK
RUN(region.regionAnchorX = 16)
EXPECTED (region.regionAnchorX == '16') OK
RUN(region.regionAnchorY = 8)
EXPECTED (region.regionAnchorY == '8') OK
RUN(region.width = 42)
EXPECTED (region.width == '42') OK
END OF TEST