Bug 580796 - "ASSERTION: Returning unknown unit type" regression from bug 515116. r=longsonr a=roc

--HG--
extra : rebase_source : 5aa4913dab0572bbbf7aed3a961348c69fcb0542
This commit is contained in:
Jonathan Watt 2010-12-05 20:28:08 +00:00
Родитель 39535c2d9f
Коммит f6ef6aab4a
3 изменённых файлов: 60 добавлений и 1 удалений

Просмотреть файл

@ -86,6 +86,10 @@ SVGLength::SetValueFromString(const nsAString &aValue)
}
nsCAutoString unitStr(unit, theRest - unit);
tmpUnit = GetUnitTypeForString(unitStr.get());
if (tmpUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN) {
// nsSVGUtils::ReportToConsole
return PR_FALSE;
}
} else {
tmpUnit = nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER;
}
@ -272,7 +276,6 @@ GetUnitTypeForString(const char* unitStr)
return i;
}
}
NS_NOTREACHED("Returning unknown unit type");
return nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN;
}

Просмотреть файл

@ -68,6 +68,7 @@ _TEST_FILES = \
test_pointer-events.xhtml \
test_scientific.html \
scientific-helper.svg \
test_SVGLengthList.xhtml \
test_SVGPathSegList.xhtml \
test_SVGStyleElement.xhtml \
test_SVGxxxList.xhtml \

Просмотреть файл

@ -0,0 +1,55 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=515116
-->
<head>
<title>Tests specific to SVGLengthList</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=515116">Mozilla Bug 515116</a>
<p id="display"></p>
<div id="content" style="display:none;">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<text id="text" x="10cm 20cm 30mc"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
/*
This file runs a series of SVGLengthList specific tests. Generic SVGXxxList
tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized
to other list types belongs there.
*/
function run_tests()
{
document.getElementById('svg').pauseAnimations();
var text = document.getElementById("text");
var lengths = text.x.baseVal;
is(lengths.numberOfItems, 0, 'Checking numberOfItems');
/*
is(lengths.numberOfItems, 2, 'Checking numberOfItems');
is(lengths.getItem(1).valueInSpecifiedUnits == 20, 'Checking the value of the second length');
is(lengths.getItem(1).unitType == SVGLength.SVG_LENGTHTYPE_CM, 'Checking the unit of the second length');
*/
SimpleTest.finish();
}
window.addEventListener("load", run_tests, false);
]]>
</script>
</pre>
</body>
</html>