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

Unified Diff: third_party/WebKit/LayoutTests/fast/svg/svgangle.html

Issue 2118903003: Relocate tests from fast/svg/ to svg/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-fast-svg-tests
Patch Set: Rename some files Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/svg/svgangle.html
diff --git a/third_party/WebKit/LayoutTests/fast/svg/svgangle.html b/third_party/WebKit/LayoutTests/fast/svg/svgangle.html
deleted file mode 100644
index e56cd696a9d4be7d424e930b90629149c6fd860c..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/svg/svgangle.html
+++ /dev/null
@@ -1,188 +0,0 @@
-<!doctype html>
-<title>SVGAngle tests</title>
-<script src=../../resources/testharness.js></script>
-<script src=../../resources/testharnessreport.js></script>
-<div id="testcontainer">
-<svg width="1" height="1" visibility="hidden">
-<defs><marker/></defs>
-</svg>
-</div>
-<div id=log></div>
-<script>
-var svg = document.querySelector("svg");
-var marker = document.querySelector("marker");
-var EPSILON = Math.pow(2, -8);
-var angles = [ 10, 0, 360, 500, 90, 180, 45, 25.9, 145, 270, 0.5, 0.2, 1.37, 3.14159 /* Math.PI */, 0.523599 /* Math.PI/6 */ ];
-var units = {
- "" : 1,
- "deg": 2,
- "rad": 3,
- "grad": 4,
- "turn": 5
-};
-var highestExposedUnit = 4; // SVG_ANGLETYPE_GRAD
-var unitconstants = {
- "UNKNOWN" : 0,
- "UNSPECIFIED": 1,
- "DEG": 2,
- "RAD": 3,
- "GRAD": 4,
-};
-var nonexposedunitconstants = {
- "TURN": 5
-};
-
-function convertTo(value, unit, outunit) {
- switch(unit) {
- case "":
- case "deg":
- switch(outunit) {
- case "":
- case "deg":
- return value;
- case "rad":
- return value*(Math.PI/180);
- case "grad":
- return value*(400/360);
- case "turn":
- return value/360;
- }
- case "rad":
- switch(outunit) {
- case "":
- case "deg":
- return value * 180 / Math.PI;
- case "rad":
- return value;
- case "grad":
- return value * 180 / Math.PI * 400 / 360;
- case "turn":
- return value / (2 * Math.PI);
- }
- case "grad":
- switch(outunit) {
- case "":
- case "deg":
- return value * 360 / 400;
- case "rad":
- return value * Math.PI * 2 / 400;
- case "grad":
- return value;
- case "turn":
- return value / 400;
- }
- case "turn":
- switch(outunit) {
- case "":
- case "deg":
- return value * 360;
- case "rad":
- return value * Math.PI * 2;
- case "grad":
- return value * 400;
- case "turn":
- return value;
- }
- }
-}
-
-function createAngle(valuestr) {
- var angle = svg.createSVGAngle();
- angle.valueAsString = valuestr;
- return angle;
-}
-
-for(var unit in units) {
- test(function() {
- var result = undefined;
- try {
- var a = createAngle(47 + unit);
- result = a.unitType;
- }
- catch(e) {}
- if (units[unit] > highestExposedUnit)
- assert_equals(result, undefined);
- else
- assert_equals(result, units[unit]);
- }, "SVGAngle(47" + unit + ").unitType");
-}
-
-for(var constant in unitconstants) {
- var str = "SVG_ANGLETYPE_" + constant;
- test(function() {
- assert_exists(SVGAngle, str, "");
- }, "SVGAngle." + str);
-}
-for(var constant in nonexposedunitconstants) {
- var str = "SVG_ANGLETYPE_" + constant;
- test(function() {
- assert_not_exists(SVGAngle, str, "");
- }, "SVGAngle." + str);
-}
-
-angles.forEach(function(angle) {
- for(var unit in units) {
- var anglestr = angle + unit;
- var ref;
- try {
- ref = createAngle(anglestr);
- }
- catch(e) {
- continue;
- }
-
- test(function() {
- assert_approx_equals(angle, ref.valueInSpecifiedUnits, EPSILON);
- }, "SVGAngle(" + anglestr + ").valueInSpecifiedUnits");
-
- try {
- marker.setAttribute("orient", anglestr);
-
- test(function() {
- assert_equals(marker.orientAngle.baseVal.valueAsString, anglestr);
- }, "orient=\"" + anglestr + "\".valueAsString");
-
- test(function() {
- assert_approx_equals(marker.orientAngle.baseVal.value, convertTo(angle, unit, "deg"), EPSILON);
- }, "orient=\"" + anglestr + "\".value");
- }
- finally {
- marker.removeAttribute("orient");
- }
-
- for (var otherunit in units) {
- test(function() {
- var a = createAngle(anglestr);
- try {
- a.convertToSpecifiedUnits(units[otherunit]);
- }
- catch(e) {}
-
- // unknown unit
- if (units[otherunit] > highestExposedUnit)
- assert_approx_equals(a.valueInSpecifiedUnits, angle, EPSILON);
- else
- assert_approx_equals(a.valueInSpecifiedUnits, convertTo(angle, unit, otherunit), EPSILON);
- }, "SVGAngle(" + anglestr + ").convertToSpecifiedUnits(" + units[otherunit] + " /*" + (otherunit ? otherunit : "unspecified") + "*/)");
-
- test(function() {
- var result = "";
- try {
- var a = createAngle(47 + otherunit);
- a.newValueSpecifiedUnits(units[unit], angle);
- result = a.valueAsString;
- }
- catch(e) {
- }
-
- // unknown unit
- if (units[unit] > highestExposedUnit || units[otherunit] > highestExposedUnit)
- assert_equals(result, "");
- else
- assert_equals(result, ref.valueAsString);
- }, "newValueSpecifiedUnits(" + units[unit] + ", " + angle + ")" );
- };
- }
-});
-
-</script>

Powered by Google App Engine
This is Rietveld 408576698