blob: b8f3ebd4e48c7aa607b60f0c562de8a8fcf37a06 [file] [log] [blame]
Test that getting color properties from a CanvasRenderingContext2D returns properly formatted values.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS checkDefaultValue(ctx.strokeStyle) is '#000000'
PASS checkDefaultValue(ctx.fillStyle) is '#000000'
PASS checkDefaultValue(ctx.shadowColor) is 'rgba(0, 0, 0, 0)'
PASS trySettingFillColorWithOverrideAlpha('red', 0) is 'rgba(255, 0, 0, 0)'
PASS trySettingStrokeColorWithOverrideAlpha('red', 0) is 'rgba(255, 0, 0, 0)'
PASS trySettingShadowWithOverrideAlpha('red', 0) is 'rgba(255, 0, 0, 0)'
PASS trySettingFillColorWithOverrideAlpha('black', 1) is '#000000'
PASS trySettingStrokeColorWithOverrideAlpha('black', 1) is '#000000'
PASS trySettingShadowWithOverrideAlpha('black', 1) is '#000000'
PASS trySettingFillColorRGBA(0, 0, 0, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeColorRGBA(0, 0, 0, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowRGBA(0, 0, 0, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingFillColorRGBA(255, 255, 255, 1) is '#ffffff'
PASS trySettingStrokeColorRGBA(255, 255, 255, 1) is '#ffffff'
PASS trySettingShadowRGBA(255, 255, 255, 1) is '#ffffff'
PASS trySettingFillColorRGBA(255, 0, 0, 0) is 'rgba(255, 0, 0, 0)'
PASS trySettingStrokeColorRGBA(255, 0, 0, 0) is 'rgba(255, 0, 0, 0)'
PASS trySettingShadowRGBA(255, 0, 0, 0) is 'rgba(255, 0, 0, 0)'
PASS trySettingFillColorRGBA(255, 0, 0, 0.4) is 'rgba(255, 0, 0, 0.4)'
PASS trySettingStrokeColorRGBA(255, 0, 0, 0.4) is 'rgba(255, 0, 0, 0.4)'
PASS trySettingShadowRGBA(255, 0, 0, 0.4) is 'rgba(255, 0, 0, 0.4)'
PASS trySettingFillColorCMYKA(0, 0, 0, 0, 0) is 'rgba(255, 255, 255, 0)'
PASS trySettingStrokeColorCMYKA(0, 0, 0, 0, 0) is 'rgba(255, 255, 255, 0)'
PASS trySettingShadowCMYKA(0, 0, 0, 0, 0) is 'rgba(255, 255, 255, 0)'
PASS trySettingFillColorCMYKA(0, 0, 0, 0, 1) is '#ffffff'
PASS trySettingStrokeColorCMYKA(0, 0, 0, 0, 1) is '#ffffff'
PASS trySettingShadowCMYKA(0, 0, 0, 0, 1) is '#ffffff'
PASS trySettingFillColorCMYKA(0, 1, 0, 0, 0) is 'rgba(255, 0, 255, 0)'
PASS trySettingStrokeColorCMYKA(0, 1, 0, 0, 0) is 'rgba(255, 0, 255, 0)'
PASS trySettingShadowCMYKA(0, 1, 0, 0, 0) is 'rgba(255, 0, 255, 0)'
PASS trySettingFillColorCMYKA(0, 1, 0, 0, 1) is '#ff00ff'
PASS trySettingStrokeColorCMYKA(0, 1, 0, 0, 1) is '#ff00ff'
PASS trySettingShadowCMYKA(0, 1, 0, 0, 1) is '#ff00ff'
PASS trySettingFillColorCMYKA(0, 0, 0, 1, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeColorCMYKA(0, 0, 0, 1, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowCMYKA(0, 0, 0, 1, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingFillColorCMYKA(0, 0, 0, 1, 1) is '#000000'
PASS trySettingStrokeColorCMYKA(0, 0, 0, 1, 1) is '#000000'
PASS trySettingShadowCMYKA(0, 0, 0, 1, 1) is '#000000'
PASS trySettingFillColorGrayLevel(0) is '#000000'
PASS trySettingStrokeColorGrayLevel(0) is '#000000'
PASS trySettingShadowGrayLevel(0) is '#000000'
PASS trySettingFillColorGrayLevel(0.5) is '#808080'
PASS trySettingStrokeColorGrayLevel(0.5) is '#808080'
PASS trySettingShadowGrayLevel(0.5) is '#808080'
PASS trySettingFillColorGrayLevel(1) is '#ffffff'
PASS trySettingStrokeColorGrayLevel(1) is '#ffffff'
PASS trySettingShadowGrayLevel(1) is '#ffffff'
PASS trySettingFillColorGrayLevelWithAlpha(0, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeColorGrayLevelWithAlpha(0, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowGrayLevelWithAlpha(0, 0) is 'rgba(0, 0, 0, 0)'
PASS trySettingFillColorGrayLevelWithAlpha(0, 0.4) is 'rgba(0, 0, 0, 0.4)'
PASS trySettingStrokeColorGrayLevelWithAlpha(0, 0.4) is 'rgba(0, 0, 0, 0.4)'
PASS trySettingShadowGrayLevelWithAlpha(0, 0.4) is 'rgba(0, 0, 0, 0.4)'
PASS trySettingFillColorGrayLevelWithAlpha(0, 1) is '#000000'
PASS trySettingStrokeColorGrayLevelWithAlpha(0, 1) is '#000000'
PASS trySettingShadowGrayLevelWithAlpha(0, 1) is '#000000'
PASS trySettingFillColorGrayLevelWithAlpha(0.5, 0) is 'rgba(128, 128, 128, 0)'
PASS trySettingStrokeColorGrayLevelWithAlpha(0.5, 0) is 'rgba(128, 128, 128, 0)'
PASS trySettingShadowGrayLevelWithAlpha(0.5, 0) is 'rgba(128, 128, 128, 0)'
PASS trySettingFillColorGrayLevelWithAlpha(0.5, 0.4) is 'rgba(128, 128, 128, 0.4)'
PASS trySettingStrokeColorGrayLevelWithAlpha(0.5, 0.4) is 'rgba(128, 128, 128, 0.4)'
PASS trySettingShadowGrayLevelWithAlpha(0.5, 0.4) is 'rgba(128, 128, 128, 0.4)'
PASS trySettingFillColorGrayLevelWithAlpha(0.5, 1) is '#808080'
PASS trySettingStrokeColorGrayLevelWithAlpha(0.5, 1) is '#808080'
PASS trySettingShadowGrayLevelWithAlpha(0.5, 1) is '#808080'
PASS trySettingFillColorGrayLevelWithAlpha(1, 0) is 'rgba(255, 255, 255, 0)'
PASS trySettingStrokeColorGrayLevelWithAlpha(1, 0) is 'rgba(255, 255, 255, 0)'
PASS trySettingShadowGrayLevelWithAlpha(1, 0) is 'rgba(255, 255, 255, 0)'
PASS trySettingFillColorGrayLevelWithAlpha(1, 0.4) is 'rgba(255, 255, 255, 0.4)'
PASS trySettingStrokeColorGrayLevelWithAlpha(1, 0.4) is 'rgba(255, 255, 255, 0.4)'
PASS trySettingShadowGrayLevelWithAlpha(1, 0.4) is 'rgba(255, 255, 255, 0.4)'
PASS trySettingFillColorGrayLevelWithAlpha(1, 1) is '#ffffff'
PASS trySettingStrokeColorGrayLevelWithAlpha(1, 1) is '#ffffff'
PASS trySettingShadowGrayLevelWithAlpha(1, 1) is '#ffffff'
PASS trySettingStrokeStyle('transparent') is 'rgba(0, 0, 0, 0)'
PASS trySettingFillStyle('transparent') is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowColor('transparent') is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeStyle('red') is '#ff0000'
PASS trySettingFillStyle('red') is '#ff0000'
PASS trySettingShadowColor('red') is '#ff0000'
PASS trySettingStrokeStyle('white') is '#ffffff'
PASS trySettingFillStyle('white') is '#ffffff'
PASS trySettingShadowColor('white') is '#ffffff'
PASS trySettingStrokeStyle('') is '#666666'
PASS trySettingFillStyle('') is '#666666'
PASS trySettingShadowColor('') is '#666666'
PASS trySettingStrokeStyle('RGBA(0, 0, 0, 0)') is 'rgba(0, 0, 0, 0)'
PASS trySettingFillStyle('RGBA(0, 0, 0, 0)') is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowColor('RGBA(0, 0, 0, 0)') is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeStyle('rgba(0,255,0,1.0)') is '#00ff00'
PASS trySettingFillStyle('rgba(0,255,0,1.0)') is '#00ff00'
PASS trySettingShadowColor('rgba(0,255,0,1.0)') is '#00ff00'
PASS trySettingStrokeStyle('rgba(1,2,3,0.4)') is 'rgba(1, 2, 3, 0.4)'
PASS trySettingFillStyle('rgba(1,2,3,0.4)') is 'rgba(1, 2, 3, 0.4)'
PASS trySettingShadowColor('rgba(1,2,3,0.4)') is 'rgba(1, 2, 3, 0.4)'
PASS trySettingStrokeStyle('RgB(1,2,3)') is '#010203'
PASS trySettingFillStyle('RgB(1,2,3)') is '#010203'
PASS trySettingShadowColor('RgB(1,2,3)') is '#010203'
PASS trySettingStrokeStyle('rGbA(1,2,3,0)') is 'rgba(1, 2, 3, 0)'
PASS trySettingFillStyle('rGbA(1,2,3,0)') is 'rgba(1, 2, 3, 0)'
PASS trySettingShadowColor('rGbA(1,2,3,0)') is 'rgba(1, 2, 3, 0)'
PASS trySettingStrokeStyle(true) is '#666666'
PASS trySettingFillStyle(true) is '#666666'
PASS trySettingShadowColor(true) is '#666666'
PASS trySettingStrokeStyle(false) is '#666666'
PASS trySettingFillStyle(false) is '#666666'
PASS trySettingShadowColor(false) is '#666666'
PASS trySettingStrokeStyle(0) is '#666666'
PASS trySettingFillStyle(0) is '#666666'
PASS trySettingShadowColor(0) is '#666666'
PASS trySettingStrokeStyle(1) is '#666666'
PASS trySettingFillStyle(1) is '#666666'
PASS trySettingShadowColor(1) is '#666666'
PASS trySettingStrokeStyle(-1) is '#666666'
PASS trySettingFillStyle(-1) is '#666666'
PASS trySettingShadowColor(-1) is '#666666'
PASS trySettingStrokeStyle(NaN) is '#666666'
PASS trySettingFillStyle(NaN) is '#666666'
PASS trySettingShadowColor(NaN) is '#666666'
PASS trySettingStrokeStyle(Infinity) is '#666666'
PASS trySettingFillStyle(Infinity) is '#666666'
PASS trySettingShadowColor(Infinity) is '#666666'
PASS trySettingStrokeStyle(null) is '#666666'
PASS trySettingFillStyle(null) is '#666666'
PASS trySettingShadowColor(null) is '#666666'
PASS trySettingStrokeStyle('left') is '#666666'
PASS trySettingFillStyle('left') is '#666666'
PASS trySettingShadowColor('left') is '#666666'
PASS trySettingStrokeStyle('right') is '#666666'
PASS trySettingFillStyle('right') is '#666666'
PASS trySettingShadowColor('right') is '#666666'
PASS trySettingStrokeStyle('center') is '#666666'
PASS trySettingFillStyle('center') is '#666666'
PASS trySettingShadowColor('center') is '#666666'
PASS trySettingStrokeStyle('border') is '#666666'
PASS trySettingFillStyle('border') is '#666666'
PASS trySettingShadowColor('border') is '#666666'
PASS trySettingStrokeStyle('border-box') is '#666666'
PASS trySettingFillStyle('border-box') is '#666666'
PASS trySettingShadowColor('border-box') is '#666666'
PASS trySettingStrokeStyle('content') is '#666666'
PASS trySettingFillStyle('content') is '#666666'
PASS trySettingShadowColor('content') is '#666666'
PASS trySettingStrokeStyle('logical') is '#666666'
PASS trySettingFillStyle('logical') is '#666666'
PASS trySettingShadowColor('logical') is '#666666'
PASS trySettingStrokeStyle('visual') is '#666666'
PASS trySettingFillStyle('visual') is '#666666'
PASS trySettingShadowColor('visual') is '#666666'
PASS trySettingStrokeColorWithSetter('transparent') is 'rgba(0, 0, 0, 0)'
PASS trySettingFillColorWithSetter('transparent') is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowWithSetter('transparent') is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeColorWithSetter('red') is '#ff0000'
PASS trySettingFillColorWithSetter('red') is '#ff0000'
PASS trySettingShadowWithSetter('red') is '#ff0000'
PASS trySettingStrokeColorWithSetter('white') is '#ffffff'
PASS trySettingFillColorWithSetter('white') is '#ffffff'
PASS trySettingShadowWithSetter('white') is '#ffffff'
PASS trySettingStrokeColorWithSetter('') is '#666666'
PASS trySettingFillColorWithSetter('') is '#666666'
PASS trySettingShadowWithSetter('') is '#666666'
PASS trySettingStrokeColorWithSetter('RGBA(0, 0, 0, 0)') is 'rgba(0, 0, 0, 0)'
PASS trySettingFillColorWithSetter('RGBA(0, 0, 0, 0)') is 'rgba(0, 0, 0, 0)'
PASS trySettingShadowWithSetter('RGBA(0, 0, 0, 0)') is 'rgba(0, 0, 0, 0)'
PASS trySettingStrokeColorWithSetter('rgba(0,255,0,1.0)') is '#00ff00'
PASS trySettingFillColorWithSetter('rgba(0,255,0,1.0)') is '#00ff00'
PASS trySettingShadowWithSetter('rgba(0,255,0,1.0)') is '#00ff00'
PASS trySettingStrokeColorWithSetter('rgba(1,2,3,0.4)') is 'rgba(1, 2, 3, 0.4)'
PASS trySettingFillColorWithSetter('rgba(1,2,3,0.4)') is 'rgba(1, 2, 3, 0.4)'
PASS trySettingShadowWithSetter('rgba(1,2,3,0.4)') is 'rgba(1, 2, 3, 0.4)'
PASS trySettingStrokeColorWithSetter('RgB(1,2,3)') is '#010203'
PASS trySettingFillColorWithSetter('RgB(1,2,3)') is '#010203'
PASS trySettingShadowWithSetter('RgB(1,2,3)') is '#010203'
PASS trySettingStrokeColorWithSetter('rGbA(1,2,3,0)') is 'rgba(1, 2, 3, 0)'
PASS trySettingFillColorWithSetter('rGbA(1,2,3,0)') is 'rgba(1, 2, 3, 0)'
PASS trySettingShadowWithSetter('rGbA(1,2,3,0)') is 'rgba(1, 2, 3, 0)'
PASS tryClearShadowAfterSettingColor('red') is 'rgba(0, 0, 0, 0)'
PASS tryClearShadowAfterSettingColor('rgba(0, 5, 10, 0.4)') is 'rgba(0, 0, 0, 0)'
PASS successfullyParsed is true
TEST COMPLETE