Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[SVG] Update SVG source to return string literals as ASCIILiteral and…
… add test cases for case sensitivity https://bugs.webkit.org/show_bug.cgi?id=154373 Patch by Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> on 2016-02-23 Reviewed by Youenn Fablet. Source/WebCore: Update SVGAnimatedEnumeration toString method to return ASCIILiteral for string literals and add test cases for case-sensitivity for these elements. Test: svg/dom/SVGAnimatedEnumeration-case-sensitive.html * svg/SVGComponentTransferFunctionElement.h: (WebCore::SVGPropertyTraits<ComponentTransferType>::toString): * svg/SVGFEBlendElement.h: (WebCore::SVGPropertyTraits<BlendMode>::toString): * svg/SVGFEColorMatrixElement.h: (WebCore::SVGPropertyTraits<ColorMatrixType>::toString): * svg/SVGFECompositeElement.h: (WebCore::SVGPropertyTraits<CompositeOperationType>::toString): * svg/SVGFEConvolveMatrixElement.h: (WebCore::SVGPropertyTraits<EdgeModeType>::toString): * svg/SVGFEDisplacementMapElement.h: (WebCore::SVGPropertyTraits<ChannelSelectorType>::toString): * svg/SVGFEMorphologyElement.h: (WebCore::SVGPropertyTraits<MorphologyOperatorType>::toString): * svg/SVGFETurbulenceElement.h: (WebCore::SVGPropertyTraits<SVGStitchOptions>::toString): (WebCore::SVGPropertyTraits<TurbulenceType>::toString): * svg/SVGGradientElement.h: (WebCore::SVGPropertyTraits<SVGSpreadMethodType>::toString): * svg/SVGMarkerElement.h: (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): * svg/SVGTextContentElement.h: (WebCore::SVGPropertyTraits<SVGLengthAdjustType>::toString): * svg/SVGTextPathElement.h: (WebCore::SVGPropertyTraits<SVGTextPathMethodType>::toString): (WebCore::SVGPropertyTraits<SVGTextPathSpacingType>::toString): * svg/SVGUnitTypes.h: (WebCore::SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::toString): LayoutTests: Add test cases for case-sensitivity for SVGAnimatedEnumeration elements. * svg/dom/SVGAnimatedEnumeration-case-sensitive-expected.txt: Added. * svg/dom/SVGAnimatedEnumeration-case-sensitive.html: Added. * svg/dom/script-tests/SVGAnimatedEnumeration-case-sensitive.js: Added. (testCaseSensitivity): Canonical link: https://commits.webkit.org/172683@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
d06e228
commit a2f4ffd
Showing
18 changed files
with
808 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
487 changes: 487 additions & 0 deletions
487
LayoutTests/svg/dom/SVGAnimatedEnumeration-case-sensitive-expected.txt
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
LayoutTests/svg/dom/SVGAnimatedEnumeration-case-sensitive.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script src="script-tests/SVGAnimatedEnumeration-case-sensitive.js"></script> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
207 changes: 207 additions & 0 deletions
207
LayoutTests/svg/dom/script-tests/SVGAnimatedEnumeration-case-sensitive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
description("This test checks the case-sensitivity of SVGAnimatedEnumeration elements"); | ||
|
||
var svgAnimatedEnumeration = { | ||
|
||
"SVGComponentTransferFunctionElement" : { | ||
"type" : [ | ||
{"id" : "identity", "val" : "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY"}, | ||
{"id" : "table", "val" : "SVG_FECOMPONENTTRANSFER_TYPE_TABLE"}, | ||
{"id" : "discrete", "val" : "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE"}, | ||
{"id" : "linear", "val" : "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR"}, | ||
{"id" : "gamma", "val" : "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA"} | ||
] | ||
}, | ||
"SVGFEBlendElement" : { | ||
"mode" : [ | ||
{"id" : "normal", "val" : "SVG_FEBLEND_MODE_NORMAL"}, | ||
{"id" : "multiply", "val" : "SVG_FEBLEND_MODE_MULTIPLY"}, | ||
{"id" : "screen", "val" : "SVG_FEBLEND_MODE_SCREEN"}, | ||
{"id" : "darken", "val" : "SVG_FEBLEND_MODE_DARKEN"}, | ||
{"id" : "lighten", "val" : "SVG_FEBLEND_MODE_LIGHTEN"} | ||
] | ||
}, | ||
"SVGFEColorMatrixElement" : { | ||
"type" : [ | ||
{"id" : "matrix", "val" : "SVG_FECOLORMATRIX_TYPE_MATRIX"}, | ||
{"id" : "saturate", "val" : "SVG_FECOLORMATRIX_TYPE_SATURATE"}, | ||
{"id" : "hueRotate", "val" : "SVG_FECOLORMATRIX_TYPE_HUEROTATE"}, | ||
{"id" : "luminanceToAlpha", "val" : "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA"} | ||
] | ||
}, | ||
"SVGFECompositeElement" : { | ||
"operator" : [ | ||
{"id" : "over", "val" : "SVG_FECOMPOSITE_OPERATOR_OVER"}, | ||
{"id" : "in", "val" : "SVG_FECOMPOSITE_OPERATOR_IN"}, | ||
{"id" : "out", "val" : "SVG_FECOMPOSITE_OPERATOR_OUT"}, | ||
{"id" : "atop", "val" : "SVG_FECOMPOSITE_OPERATOR_ATOP"}, | ||
{"id" : "xor", "val" : "SVG_FECOMPOSITE_OPERATOR_XOR"}, | ||
{"id" : "arithmetic", "val" : "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC"} | ||
] | ||
}, | ||
"SVGFEConvolveMatrixElement" : { | ||
"edgeMode" : [ | ||
{"id" : "duplicate", "val" : "SVG_EDGEMODE_DUPLICATE"}, | ||
{"id" : "wrap", "val" : "SVG_EDGEMODE_WRAP"}, | ||
{"id" : "none", "val" : "SVG_EDGEMODE_NONE"} | ||
] | ||
}, | ||
"SVGFEDisplacementMapElement" : { | ||
"xChannelSelector" : [ | ||
{"id" : "R", "val" : "SVG_CHANNEL_R"}, | ||
{"id" : "G", "val" : "SVG_CHANNEL_G"}, | ||
{"id" : "B", "val" : "SVG_CHANNEL_B"}, | ||
{"id" : "A", "val" : "SVG_CHANNEL_A"} | ||
] | ||
}, | ||
"SVGFEMorphologyElement" : { | ||
"operator" : [ | ||
{"id" : "erode", "val" : "SVG_MORPHOLOGY_OPERATOR_ERODE"}, | ||
{"id" : "dilate", "val" : "SVG_MORPHOLOGY_OPERATOR_DILATE"} | ||
] | ||
}, | ||
"SVGFETurbulenceElement" : { | ||
"type" : [ | ||
{"id" : "fractalNoise", "val" : "SVG_TURBULENCE_TYPE_FRACTALNOISE"}, | ||
{"id" : "turbulence", "val" : "SVG_TURBULENCE_TYPE_TURBULENCE"} | ||
], | ||
"stitchTiles" : [ | ||
{"id" : "stitch", "val" : "SVG_STITCHTYPE_STITCH"}, | ||
{"id" : "noStitch", "val" : "SVG_STITCHTYPE_NOSTITCH"} | ||
] | ||
}, | ||
"SVGGradientElement" : { | ||
"spreadMethod" : [ | ||
{"id" : "pad", "val" : "SVG_SPREADMETHOD_PAD"}, | ||
{"id" : "reflect", "val" : "SVG_SPREADMETHOD_REFLECT"}, | ||
{"id" : "repeat", "val" : "SVG_SPREADMETHOD_REPEAT"} | ||
] | ||
}, | ||
"SVGMarkerElement" : { | ||
"markerUnits" : [ | ||
{"id" : "userSpaceOnUse", "val" : "SVG_MARKERUNITS_USERSPACEONUSE"}, | ||
{"id" : "strokeWidth", "val" : "SVG_MARKERUNITS_STROKEWIDTH"} | ||
] | ||
}, | ||
"SVGTextContentElement" : { | ||
"lengthAdjust" : [ | ||
{"id" : "spacing", "val" : "LENGTHADJUST_SPACING"}, | ||
{"id" : "spacingAndGlyphs", "val" : "LENGTHADJUST_SPACINGANDGLYPHS"} | ||
] | ||
}, | ||
"SVGTextPathElement" : { | ||
"method" : [ | ||
{"id" : "align", "val" : "TEXTPATH_METHODTYPE_ALIGN"}, | ||
{"id" : "stretch", "val" : "TEXTPATH_METHODTYPE_STRETCH"} | ||
], | ||
"spacing" : [ | ||
{"id" : "auto", "val" : "TEXTPATH_SPACINGTYPE_AUTO"}, | ||
{"id" : "exact", "val" : "TEXTPATH_SPACINGTYPE_EXACT"} | ||
] | ||
}, | ||
// All *Units attributes in SVG use SVGUnitTypes so we only need to test this once. | ||
"SVGUnitTypes" : { | ||
"gradientUnits" : [ | ||
{"id" : "userSpaceOnUse", "val" : "SVG_UNIT_TYPE_USERSPACEONUSE"}, | ||
{"id" : "objectBoundingBox", "val" : "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"} | ||
] | ||
}, | ||
}; | ||
|
||
function testCaseSensitivity(elementType, element, enumType) | ||
{ | ||
debug(""); | ||
debug("Check valid " + element.tagName + " '" + enumType + "'"); | ||
|
||
var enumValues = svgAnimatedEnumeration[elementType][enumType]; | ||
|
||
for (var i = 0; i < enumValues.length; i++) { | ||
debug(""); | ||
shouldBeUndefined(element.id + ".setAttribute('" + enumType + "', '" + enumValues[i].id + "')"); | ||
shouldBeEqualToString(element.id + ".getAttribute('" + enumType + "')", enumValues[i].id); | ||
shouldBe(element.id + "." + enumType + ".baseVal", elementType + "." + enumValues[i].val); | ||
} | ||
|
||
debug(""); | ||
debug("Check invalid case " + element.tagName + " '" + enumType + "'"); | ||
for (var i = 0; i < enumValues.length; i++) { | ||
var val = enumValues[i].id; | ||
var alt_val = enumValues[((i + 1) % enumValues.length)]; | ||
|
||
debug(""); | ||
|
||
debug(element.id + ".setAttribute('" + enumType + "', '" + alt_val.id + "')"); | ||
element.setAttribute(enumType, alt_val.id); | ||
|
||
var val_check = (val.toUpperCase() == val) ? val.toLowerCase() : val.toUpperCase(); | ||
shouldBeUndefined(element.id + ".setAttribute('" + enumType + "', '" + val_check + "')"); | ||
shouldBeEqualToString(element.id + ".getAttribute('" + enumType + "')", val_check); | ||
shouldBe(element.id + "." + enumType + ".baseVal", elementType + "." + alt_val.val); | ||
} | ||
} | ||
|
||
// SVGComponentTransferFunctionElement | ||
var transferFunctionElement = document.createElementNS("http://www.w3.org/2000/svg", "feFuncR"); | ||
transferFunctionElement.id = "transferFunctionElement"; | ||
testCaseSensitivity("SVGComponentTransferFunctionElement", transferFunctionElement, "type"); | ||
|
||
// SVGFEBlendElement | ||
var feBlendElement = document.createElementNS("http://www.w3.org/2000/svg", "feBlend"); | ||
feBlendElement.id = "feBlendElement"; | ||
testCaseSensitivity("SVGFEBlendElement", feBlendElement, "mode"); | ||
|
||
// SVGFEColorMatrixElement | ||
var feColorMatrixElement = document.createElementNS("http://www.w3.org/2000/svg", "feColorMatrix"); | ||
feColorMatrixElement.id = "feColorMatrixElement"; | ||
testCaseSensitivity("SVGFEColorMatrixElement", feColorMatrixElement, "type"); | ||
|
||
// SVGFECompositeElement | ||
var feCompositeElement = document.createElementNS("http://www.w3.org/2000/svg", "feComposite"); | ||
feCompositeElement.id = "feCompositeElement"; | ||
testCaseSensitivity("SVGFECompositeElement", feCompositeElement, "operator"); | ||
|
||
// SVGFEConvolveMatrixElement | ||
var feConvolveMatrixElement = document.createElementNS("http://www.w3.org/2000/svg", "feConvolveMatrix"); | ||
feConvolveMatrixElement.id = "feConvolveMatrixElement"; | ||
testCaseSensitivity("SVGFEConvolveMatrixElement", feConvolveMatrixElement, "edgeMode"); | ||
|
||
// SVGFEDisplacementMapElement | ||
var feDisplacementMapElement = document.createElementNS("http://www.w3.org/2000/svg", "feDisplacementMap"); | ||
feDisplacementMapElement.id = "feDisplacementMapElement"; | ||
testCaseSensitivity("SVGFEDisplacementMapElement", feDisplacementMapElement, "xChannelSelector"); | ||
|
||
// SVGFEMorphologyElement | ||
var feMorphologyElement = document.createElementNS("http://www.w3.org/2000/svg", "feMorphology"); | ||
feMorphologyElement.id = "feMorphologyElement"; | ||
testCaseSensitivity("SVGFEMorphologyElement", feMorphologyElement, "operator"); | ||
|
||
// SVGFETurbulenceElement | ||
var feTurbulenceElement = document.createElementNS("http://www.w3.org/2000/svg", "feTurbulence"); | ||
feTurbulenceElement.id = "feTurbulenceElement"; | ||
testCaseSensitivity("SVGFETurbulenceElement", feTurbulenceElement, "type"); | ||
testCaseSensitivity("SVGFETurbulenceElement", feTurbulenceElement, "stitchTiles"); | ||
|
||
// SVGGradientElement | ||
var gradientElement = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"); | ||
gradientElement.id = "gradientElement"; | ||
testCaseSensitivity("SVGGradientElement", gradientElement, "spreadMethod"); | ||
testCaseSensitivity("SVGUnitTypes", gradientElement, "gradientUnits"); | ||
|
||
// SVGMarkerElement | ||
var markerElement = document.createElementNS("http://www.w3.org/2000/svg", "marker"); | ||
markerElement.id = "markerElement"; | ||
testCaseSensitivity("SVGMarkerElement", markerElement, "markerUnits"); | ||
|
||
// SVGTextContentElement | ||
var textContentElement = document.createElementNS("http://www.w3.org/2000/svg", "text"); | ||
textContentElement.id = "textContentElement"; | ||
testCaseSensitivity("SVGTextContentElement", textContentElement, "lengthAdjust"); | ||
|
||
// SVGTextPathElement | ||
var textPathElement = document.createElementNS("http://www.w3.org/2000/svg", "textPath"); | ||
textPathElement.id = "textPathElement"; | ||
testCaseSensitivity("SVGTextPathElement", textPathElement, "method"); | ||
testCaseSensitivity("SVGTextPathElement", textPathElement, "spacing"); | ||
|
||
debug(""); | ||
|
||
successfullyParsed = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.