Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/svg/linking/scripted/href-mpath-element.html

Issue 2408493002: Import wpt@357b83b809e3cbc7a1805e7c3ca108a7980d782f (Closed)
Patch Set: Added one more win7-specific baseline Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Href - mpath element tests</title>
4 <script src='/resources/testharness.js'></script>
5 <script src='/resources/testharnessreport.js'></script>
6 <script src='testcommon.js'></script>
7 <body>
8 <div id='log'></div>
9 <svg id='svg' width='100' height='100' viewBox='0 0 100 100'></svg>
10 <script>
11 'use strict';
12
13 promise_test(function(t) {
14 var svg = document.getElementById('svg');
15 var path1 = createSVGElement(t, 'path', svg,
16 { 'id': 'MyPath1', 'd': 'M 0,0 L 100,0' });
17 var path2 = createSVGElement(t, 'path', svg,
18 { 'id': 'MyPath2', 'd': 'M 0,0 L 0,100' });
19 var rect = createSVGElement(t, 'rect', svg,
20 { 'width': '10px', 'height': '10px' });
21 var animateMotion = createSVGElement(t, 'animateMotion', rect,
22 { 'dur': '10s' });
23 var mpath = createSVGElement(t, 'mpath', animateMotion);
24 mpath.setAttribute('href', '#MyPath1');
25 mpath.setAttributeNS(XLINKNS, 'xlink:href', '#MyPath2');
26 assert_equals(mpath.href.baseVal, '#MyPath1');
27
28 return waitEvent(animateMotion, 'begin').then(function() {
29 svg.pauseAnimations();
30 svg.setCurrentTime(1);
31 var ctm = rect.getCTM();
32 assert_equals(ctm.e, 10);
33 assert_equals(ctm.f, 0);
34
35 svg.setCurrentTime(5);
36 ctm = rect.getCTM();
37 assert_equals(ctm.e, 50);
38 assert_equals(ctm.f, 0);
39 });
40 }, 'Test for mpath when setting both href and xlink:href');
41
42 promise_test(function(t) {
43 var svg = document.getElementById('svg');
44 var path1 = createSVGElement(t, 'path', svg,
45 { 'id': 'MyPath1', 'd': 'M 0,0 L 100,0' });
46 var path2 = createSVGElement(t, 'path', svg,
47 { 'id': 'MyPath2', 'd': 'M 0,0 L 0,100' });
48 var rect = createSVGElement(t, 'rect', svg,
49 { 'width': '10px', 'height': '10px' });
50 var animateMotion = createSVGElement(t, 'animateMotion', rect,
51 { 'dur': '10s' });
52 var mpath = createSVGElement(t, 'mpath', animateMotion);
53 mpath.setAttribute('href', '#MyPath1');
54 mpath.setAttributeNS(XLINKNS, 'xlink:href', '#MyPath2');
55
56 return waitEvent(animateMotion, 'begin').then(function() {
57 svg.pauseAnimations();
58 svg.setCurrentTime(5);
59 var ctm = rect.getCTM();
60 assert_equals(ctm.e, 50);
61 assert_equals(ctm.f, 0);
62
63 mpath.removeAttribute('href');
64 assert_equals(mpath.href.baseVal, '#MyPath2');
65
66 ctm = rect.getCTM();
67 assert_equals(ctm.e, 0);
68 assert_equals(ctm.f, 50);
69 });
70 }, 'Test for mpath when removing href but we still have xlink:href');
71
72 promise_test(function(t) {
73 var svg = document.getElementById('svg');
74 var path1 = createSVGElement(t, 'path', svg,
75 { 'id': 'MyPath1', 'd': 'M 0,0 L 100,0' });
76 var path2 = createSVGElement(t, 'path', svg,
77 { 'id': 'MyPath2', 'd': 'M 0,0 L 0,100' });
78 var rect = createSVGElement(t, 'rect', svg,
79 { 'width': '10px', 'height': '10px' });
80 var animateMotion = createSVGElement(t, 'animateMotion', rect,
81 { 'dur': '10s' });
82 var mpath = createSVGElement(t, 'mpath', animateMotion);
83 mpath.setAttribute('href', '#MyPath1');
84 mpath.setAttributeNS(XLINKNS, 'xlink:href', '#MyPath2');
85
86 return waitEvent(animateMotion, 'begin').then(function() {
87 svg.pauseAnimations();
88 svg.setCurrentTime(5);
89 var ctm = rect.getCTM();
90 assert_equals(ctm.e, 50);
91 assert_equals(ctm.f, 0);
92
93 mpath.removeAttributeNS(XLINKNS, 'href');
94 assert_equals(mpath.href.baseVal, '#MyPath1');
95
96 ctm = rect.getCTM();
97 assert_equals(ctm.e, 50);
98 assert_equals(ctm.f, 0);
99 });
100 }, 'Test for mpath when removing xlink:href but we still have href');
101
102 </script>
103 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698