diff options
author | ed@opera.com <ed@opera.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2014-03-24 18:06:19 +0000 |
---|---|---|
committer | ed@opera.com <ed@opera.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2014-03-24 18:06:19 +0000 |
commit | 94d5a8d90c0f15e0232a178c1e472ffc5980a7ef (patch) | |
tree | 0a5e611c68c22d1f8f57dfcea12283899d6f74dc /third_party/WebKit/LayoutTests/fast | |
parent | 06f0b6be08ba75d26cc04ee35ae854961d1cb068 (diff) | |
download | chromium_src-94d5a8d90c0f15e0232a178c1e472ffc5980a7ef.zip chromium_src-94d5a8d90c0f15e0232a178c1e472ffc5980a7ef.tar.gz chromium_src-94d5a8d90c0f15e0232a178c1e472ffc5980a7ef.tar.bz2 |
[SVG2] Add onbegin, onend and onrepeat EventHandlers on SVGAnimationElement
These map to the eventnames 'beginEvent', 'endEvent' and 'repeatEvent'
respectively.
Spec:
https://svgwg.org/svg2-draft/animate.html#InterfaceSVGAnimationElement
BUG=338288
NOTRY=true
Review URL: https://codereview.chromium.org/201673003
git-svn-id: svn://svn.chromium.org/blink/trunk@169871 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast')
4 files changed, 170 insertions, 1 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/dom/event-attribute-availability-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/event-attribute-availability-expected.txt index 22ef028..6029949 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/event-attribute-availability-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/event-attribute-availability-expected.txt @@ -344,6 +344,9 @@ PASS 'onpaste' in pathelement is true PASS 'onreset' in pathelement is true PASS 'onsearch' in pathelement is true PASS 'onselectstart' in pathelement is true +PASS 'onbegin' in pathelement is false +PASS 'onend' in pathelement is false +PASS 'onrepeat' in pathelement is false Test SVGSVGElement PASS 'onabort' in svgelement is true @@ -384,6 +387,52 @@ PASS 'onpaste' in svgelement is true PASS 'onreset' in svgelement is true PASS 'onsearch' in svgelement is true PASS 'onselectstart' in svgelement is true +PASS 'onbegin' in svgelement is false +PASS 'onend' in svgelement is false +PASS 'onrepeat' in svgelement is false + +Test SVGAnimationElement +PASS 'onabort' in animateelement is true +PASS 'onblur' in animateelement is true +PASS 'onchange' in animateelement is true +PASS 'onclick' in animateelement is true +PASS 'oncontextmenu' in animateelement is true +PASS 'ondblclick' in animateelement is true +PASS 'ondrag' in animateelement is true +PASS 'ondragend' in animateelement is true +PASS 'ondragenter' in animateelement is true +PASS 'ondragleave' in animateelement is true +PASS 'ondragover' in animateelement is true +PASS 'ondragstart' in animateelement is true +PASS 'ondrop' in animateelement is true +PASS 'onerror' in animateelement is true +PASS 'onfocus' in animateelement is true +PASS 'oninput' in animateelement is true +PASS 'onkeydown' in animateelement is true +PASS 'onkeypress' in animateelement is true +PASS 'onkeyup' in animateelement is true +PASS 'onload' in animateelement is true +PASS 'onmousedown' in animateelement is true +PASS 'onmousemove' in animateelement is true +PASS 'onmouseout' in animateelement is true +PASS 'onmouseover' in animateelement is true +PASS 'onmouseup' in animateelement is true +PASS 'onmousewheel' in animateelement is true +PASS 'onscroll' in animateelement is true +PASS 'onselect' in animateelement is true +PASS 'onsubmit' in animateelement is true +PASS 'onbeforecut' in animateelement is true +PASS 'oncut' in animateelement is true +PASS 'onbeforecopy' in animateelement is true +PASS 'oncopy' in animateelement is true +PASS 'onbeforepaste' in animateelement is true +PASS 'onpaste' in animateelement is true +PASS 'onreset' in animateelement is true +PASS 'onsearch' in animateelement is true +PASS 'onselectstart' in animateelement is true +PASS 'onbegin' in animateelement is true +PASS 'onend' in animateelement is true +PASS 'onrepeat' in animateelement is true PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/fast/dom/script-tests/event-attribute-availability.js b/third_party/WebKit/LayoutTests/fast/dom/script-tests/event-attribute-availability.js index 19fc825..5cca67c 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/script-tests/event-attribute-availability.js +++ b/third_party/WebKit/LayoutTests/fast/dom/script-tests/event-attribute-availability.js @@ -25,6 +25,10 @@ var bodyAndFrameSetProperties = [ // "onafterprint", "onbeforeprint", "onhashchange", "onpopstate", "onredo", "onundo" ]; +var svgAnimationElementProperties = [ + "onbegin", "onend", "onrepeat" +]; + debug("Test Element"); var element = document.createElement("div"); @@ -77,9 +81,24 @@ var pathelement = document.createElementNS("http://www.w3.org/2000/svg", "path") for (var i = 0; i < elementAndDocumentProperties.length; ++i) { shouldBeTrue("'" + elementAndDocumentProperties[i] + "' in pathelement"); } +for (var i = 0; i < svgAnimationElementProperties.length; ++i) { + shouldBeFalse("'" + svgAnimationElementProperties[i] + "' in pathelement"); +} debug("\nTest SVGSVGElement"); -var svgelement = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg").documentElement; +var svgelement = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", null).documentElement; for (var i = 0; i < elementAndDocumentProperties.length; ++i) { shouldBeTrue("'" + elementAndDocumentProperties[i] + "' in svgelement"); } +for (var i = 0; i < svgAnimationElementProperties.length; ++i) { + shouldBeFalse("'" + svgAnimationElementProperties[i] + "' in svgelement"); +} + +debug("\nTest SVGAnimationElement"); +var animateelement = document.createElementNS("http://www.w3.org/2000/svg", "animate"); +for (var i = 0; i < elementAndDocumentProperties.length; ++i) { + shouldBeTrue("'" + elementAndDocumentProperties[i] + "' in animateelement"); +} +for (var i = 0; i < svgAnimationElementProperties.length; ++i) { + shouldBeTrue("'" + svgAnimationElementProperties[i] + "' in animateelement"); +} diff --git a/third_party/WebKit/LayoutTests/fast/svg/animation-events.html b/third_party/WebKit/LayoutTests/fast/svg/animation-events.html new file mode 100644 index 0000000..56d1e22 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/svg/animation-events.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<title>EventHandlers on SVGAnimationElement test</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="script-tests/animation-events.js"></script> +<script> +var attributeToEventMap = { + "onbegin" : "beginEvent", + "onend" : "endEvent", + "onrepeat" : "repeatEvent" +}; + +for (var attribute in attributeToEventMap) { + [ + "SVGAnimateElement", + "SVGAnimateMotionElement", + "SVGAnimateTransformElement", + "SVGSetElement" + ].forEach(function(interface) { + testSet(interface, attribute); + testEnumerate(interface, attribute); + testReflect(interface, attribute); + }); + + testEventHandlerMapping(attribute, attributeToEventMap[attribute]); +}; +</script> +<div id="log"></div> diff --git a/third_party/WebKit/LayoutTests/fast/svg/script-tests/animation-events.js b/third_party/WebKit/LayoutTests/fast/svg/script-tests/animation-events.js new file mode 100644 index 0000000..35a859f --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/svg/script-tests/animation-events.js @@ -0,0 +1,73 @@ +function getObject(interface) { + switch(interface) { + case "SVGAnimateElement": + var e = document.createElementNS("http://www.w3.org/2000/svg", "animate"); + assert_true(e instanceof SVGAnimateElement); + return e; + case "SVGAnimateMotionElement": + var e = document.createElementNS("http://www.w3.org/2000/svg", "animateMotion"); + assert_true(e instanceof SVGAnimateMotionElement); + return e; + case "SVGAnimateTransformElement": + var e = document.createElementNS("http://www.w3.org/2000/svg", "animateTransform"); + assert_true(e instanceof SVGAnimateTransformElement); + return e; + case "SVGSetElement": + var e = document.createElementNS("http://www.w3.org/2000/svg", "set"); + assert_true(e instanceof SVGSetElement); + return e; + } + assert_unreached(); +} +function testSet(interface, attribute) { + test(function() { + var object = getObject(interface); + function nop() {} + assert_equals(object[attribute], null, "Initially null"); + object[attribute] = nop; + assert_equals(object[attribute], nop, "Return same function"); + object[attribute] = ""; + assert_equals(object[attribute], null, "Return null after setting string"); + object[attribute] = null; + assert_equals(object[attribute], null, "Finally null"); + }, "Set " + interface + "." + attribute); +} +function testReflect(interface, attribute) { + test(function() { + var element = getObject(interface); + assert_false(element.hasAttribute(attribute), "Initially missing"); + element.setAttribute(attribute, "return"); + assert_equals(element.getAttribute(attribute), "return", "Return same string"); + assert_equals(typeof element[attribute], "function", "Convert to function"); + element.removeAttribute(attribute); + }, "Reflect " + interface + "." + attribute); +} +// Object.propertyIsEnumerable cannot be used because it doesn't +// work with properties inherited through the prototype chain. +function getEnumerable(interface) { + var enumerable = {}; + for (var attribute in getObject(interface)) { + enumerable[attribute] = true; + } + return enumerable; +} +function testEventHandlerMapping(attribute, eventname) { + async_test(function(t) { + var element = getObject("SVGAnimateElement"); + assert_false(element.hasAttribute(attribute), "Initially missing"); + element[attribute] = function() { + t.step(function (){assert_true(true); t.done();}); + }; + var event = new CustomEvent(eventname); + element.dispatchEvent(event); + }, "Event " + eventname + " maps to " + attribute); +} +var enumerableCache = {}; +function testEnumerate(interface, attribute) { + if (!(interface in enumerableCache)) { + enumerableCache[interface] = getEnumerable(interface); + } + test(function() { + assert_true(enumerableCache[interface][attribute]); + }, "Enumerate " + interface + "." + attribute); +} |