blob: db4102f8190e84648ec3de1a66d4875871d4995e [file] [log] [blame]
This test checks the SVGMatrix API
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Check initial matrix values
PASS matrixToString(matrix) is "{ a: 1, b: 0, c: 0, d: 1, e: 0, f: 0}"
Check assigning matrices
PASS matrix.a = 2 is 2
PASS matrix.f = 200 is 200
Check assigning invalid matrices
PASS matrix.a = matrix is matrix
PASS matrix.a is NaN
PASS matrix.a = 0 is 0
PASS matrix.a = svgElement is svgElement
PASS matrix.a is NaN
PASS matrix.a = 0 is 0
PASS matrix.a = 'aString' is 'aString'
PASS matrix.a is NaN
PASS matrix.a = null is null
PASS matrix.a is 0
PASS matrix.a = 2 is 2
PASS matrix.b = matrix is matrix
PASS matrix.b is NaN
PASS matrix.b = 0 is 0
PASS matrix.b = svgElement is svgElement
PASS matrix.b is NaN
PASS matrix.b = 0 is 0
PASS matrix.b = 'aString' is 'aString'
PASS matrix.b is NaN
PASS matrix.b = null is null
PASS matrix.b is 0
PASS matrix.b = 0 is 0
PASS matrix.c = matrix is matrix
PASS matrix.c is NaN
PASS matrix.c = 0 is 0
PASS matrix.c = svgElement is svgElement
PASS matrix.c is NaN
PASS matrix.c = 0 is 0
PASS matrix.c = 'aString' is 'aString'
PASS matrix.c is NaN
PASS matrix.c = null is null
PASS matrix.c is 0
PASS matrix.c = 0 is 0
PASS matrix.d = matrix is matrix
PASS matrix.d is NaN
PASS matrix.d = 0 is 0
PASS matrix.d = svgElement is svgElement
PASS matrix.d is NaN
PASS matrix.d = 0 is 0
PASS matrix.d = 'aString' is 'aString'
PASS matrix.d is NaN
PASS matrix.d = null is null
PASS matrix.d is 0
PASS matrix.d = 1 is 1
PASS matrix.e = matrix is matrix
PASS matrix.e is NaN
PASS matrix.e = 0 is 0
PASS matrix.e = svgElement is svgElement
PASS matrix.e is NaN
PASS matrix.e = 0 is 0
PASS matrix.e = 'aString' is 'aString'
PASS matrix.e is NaN
PASS matrix.e = null is null
PASS matrix.e is 0
PASS matrix.e = 0 is 0
PASS matrix.f = matrix is matrix
PASS matrix.f is NaN
PASS matrix.f = 0 is 0
PASS matrix.f = svgElement is svgElement
PASS matrix.f is NaN
PASS matrix.f = 0 is 0
PASS matrix.f = 'aString' is 'aString'
PASS matrix.f is NaN
PASS matrix.f = null is null
PASS matrix.f is 0
PASS matrix.f = 200 is 200
Check that the matrix is still containing the correct values
PASS matrixToString(matrix) is "{ a: 2, b: 0, c: 0, d: 1, e: 0, f: 200}"
Check calling 'multiply' with invalid arguments
PASS matrix.multiply() threw exception TypeError: Not enough arguments.
PASS matrix.multiply(true) threw exception TypeError: Argument 1 ('secondMatrix') to SVGMatrix.multiply must be an instance of SVGMatrix.
PASS matrix.multiply(2) threw exception TypeError: Argument 1 ('secondMatrix') to SVGMatrix.multiply must be an instance of SVGMatrix.
PASS matrix.multiply('aString') threw exception TypeError: Argument 1 ('secondMatrix') to SVGMatrix.multiply must be an instance of SVGMatrix.
PASS matrix.multiply(svgElement) threw exception TypeError: Argument 1 ('secondMatrix') to SVGMatrix.multiply must be an instance of SVGMatrix.
Check calling 'translate' with invalid arguments
PASS matrix.translate() threw exception TypeError: Not enough arguments.
PASS matrix.translate(true) threw exception TypeError: Not enough arguments.
PASS matrix.translate(2) threw exception TypeError: Not enough arguments.
PASS matrix.translate('aString') threw exception TypeError: Not enough arguments.
PASS matrix.translate(svgElement) threw exception TypeError: Not enough arguments.
PASS matrix.translate('aString', 'aString') is non-null.
PASS matrix.translate(svgElement, svgElement) is non-null.
PASS matrix.translate(2, 'aString') is non-null.
PASS matrix.translate(2, svgElement) is non-null.
PASS matrix.translate('aString', 2) is non-null.
PASS matrix.translate(svgElement, 2) is non-null.
Check calling 'scale' with invalid arguments
PASS matrix.scale() threw exception TypeError: Not enough arguments.
PASS matrix.scale('aString') is non-null.
PASS matrix.scale(svgElement) is non-null.
Check calling 'scaleNonUniform' with invalid arguments
PASS matrix.scaleNonUniform() threw exception TypeError: Not enough arguments.
PASS matrix.scaleNonUniform(true) threw exception TypeError: Not enough arguments.
PASS matrix.scaleNonUniform(2) threw exception TypeError: Not enough arguments.
PASS matrix.scaleNonUniform('aString') threw exception TypeError: Not enough arguments.
PASS matrix.scaleNonUniform(svgElement) threw exception TypeError: Not enough arguments.
PASS matrix.scaleNonUniform('aString', 'aString') is non-null.
PASS matrix.scaleNonUniform(svgElement, svgElement) is non-null.
PASS matrix.scaleNonUniform(2, 'aString') is non-null.
PASS matrix.scaleNonUniform(2, svgElement) is non-null.
PASS matrix.scaleNonUniform('aString', 2) is non-null.
PASS matrix.scaleNonUniform(svgElement, 2) is non-null.
Check calling 'rotate' with invalid arguments
PASS matrix.rotate() threw exception TypeError: Not enough arguments.
PASS matrix.rotate('aString') is non-null.
PASS matrix.rotate(svgElement) is non-null.
Check calling 'rotateFromVector' with invalid arguments
PASS matrix.rotateFromVector() threw exception TypeError: Not enough arguments.
PASS matrix.rotateFromVector(true) threw exception TypeError: Not enough arguments.
PASS matrix.rotateFromVector(2) threw exception TypeError: Not enough arguments.
PASS matrix.rotateFromVector('aString') threw exception TypeError: Not enough arguments.
PASS matrix.rotateFromVector(svgElement) threw exception TypeError: Not enough arguments.
PASS matrix.rotateFromVector('aString', 'aString') is non-null.
PASS matrix.rotateFromVector(svgElement, svgElement) is non-null.
PASS matrix.rotateFromVector(2, 'aString') is non-null.
PASS matrix.rotateFromVector(2, svgElement) is non-null.
PASS matrix.rotateFromVector('aString', 2) is non-null.
PASS matrix.rotateFromVector(svgElement, 2) is non-null.
Check calling 'skewX' with invalid arguments
PASS matrix.skewX() threw exception TypeError: Not enough arguments.
PASS matrix.skewX('aString') is non-null.
PASS matrix.skewX(svgElement) is non-null.
Check calling 'skewY' with invalid arguments
PASS matrix.skewY() threw exception TypeError: Not enough arguments.
PASS matrix.skewY('aString') is non-null.
PASS matrix.skewY(svgElement) is non-null.
Check calling SVGMatrix methods with valid arguments
PASS matrixToString(matrix.translate(10, 20)) is "{ a: 2, b: 0, c: 0, d: 1, e: 20, f: 220}"
PASS matrixToString(matrix.scale(5)) is "{ a: 10, b: 0, c: 0, d: 5, e: 0, f: 200}"
PASS matrixToString(matrix.scaleNonUniform(2, 3)) is "{ a: 4, b: 0, c: 0, d: 3, e: 0, f: 200}"
PASS matrixToString(matrix.skewX(90)) is "{ a: 2, b: 0, c: 32662478706390740, d: 1, e: 0, f: 200}"
PASS matrixToString(matrix.skewY(90)) is "{ a: 2, b: 16331239353195370, c: 0, d: 1, e: 0, f: 200}"
Check that the matrix is still containing the correct values
PASS matrixToString(matrix) is "{ a: 2, b: 0, c: 0, d: 1, e: 0, f: 200}"
Calling methods that throw exceptions
PASS matrix.rotateFromVector(0, 4) threw exception TypeError: Type error.
PASS matrix.rotateFromVector(4, 0) threw exception TypeError: Type error.
PASS matrix.a = 0 is 0
PASS matrix.inverse() threw exception InvalidStateError: Matrix is not invertible.
PASS successfullyParsed is true
TEST COMPLETE