Merge pull request #543 from jorix/no-manual-tests2
Can test some manual tests as normal tests.
This commit is contained in:
@@ -30,6 +30,7 @@ Test.AnotherWay._run_one_onclick = function(){
|
|||||||
// test page loading
|
// test page loading
|
||||||
Test.AnotherWay.old_load_next_page = Test.AnotherWay._load_next_page;
|
Test.AnotherWay.old_load_next_page = Test.AnotherWay._load_next_page;
|
||||||
Test.AnotherWay._load_next_page = function(){
|
Test.AnotherWay._load_next_page = function(){
|
||||||
|
document.getElementById("test_iframe_el").style.display = "none";
|
||||||
Test.AnotherWay.update_running_time();
|
Test.AnotherWay.update_running_time();
|
||||||
Test.AnotherWay.old_load_next_page.apply(this, arguments);
|
Test.AnotherWay.old_load_next_page.apply(this, arguments);
|
||||||
};
|
};
|
||||||
@@ -94,6 +95,19 @@ Test.AnotherWay._add_test_page_url = function(test_url, convention){
|
|||||||
record_select.appendChild(option);
|
record_select.appendChild(option);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Test.AnotherWay.old_set_iframe_location = Test.AnotherWay._set_iframe_location;
|
||||||
|
Test.AnotherWay._set_iframe_location = function(iframe, loc, outside_path_correction){
|
||||||
|
var optionPos = loc.indexOf( "?" ),
|
||||||
|
option;
|
||||||
|
if (optionPos != -1) {
|
||||||
|
option = loc.substring(optionPos+1);
|
||||||
|
loc = loc.substring(0, optionPos);
|
||||||
|
}
|
||||||
|
if (option === "visible") {
|
||||||
|
document.getElementById("test_iframe_el").style.display = "";
|
||||||
|
}
|
||||||
|
return Test.AnotherWay.old_set_iframe_location.call(this, iframe, loc, outside_path_correction);
|
||||||
|
};
|
||||||
|
|
||||||
// new methods
|
// new methods
|
||||||
Test.AnotherWay.update_running_time = function() {
|
Test.AnotherWay.update_running_time = function() {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
top: 1234px;
|
top: 1234px;
|
||||||
left: 123px;
|
left: 123px;
|
||||||
}
|
}
|
||||||
|
.test_getRenderedDimensions p{
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
var OpenLayers = [
|
var OpenLayers = [
|
||||||
@@ -26,6 +29,7 @@
|
|||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
<script src="OLLoader.js"></script>
|
<script src="OLLoader.js"></script>
|
||||||
|
<script src="Util_common.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||||
var map;
|
var map;
|
||||||
@@ -1116,17 +1120,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_getRenderedDimensions(t) {
|
function test_getRenderedDimensions(t) {
|
||||||
t.plan(2);
|
// from <script src="Util_common.js"> and shared by Util_w3c.html
|
||||||
var content = (new Array(100)).join("foo ");
|
com_test_getRenderedDimensions(t);
|
||||||
|
|
||||||
// test with fixed width
|
|
||||||
var fw = OpenLayers.Util.getRenderedDimensions(content, {w: 20});
|
|
||||||
t.eq(fw.w, 20, "got the fixed width");
|
|
||||||
|
|
||||||
// test with fixed height
|
|
||||||
var fh = OpenLayers.Util.getRenderedDimensions(content, {h: 15});
|
|
||||||
t.eq(fh.h, 15, "got the fixed height");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_toFloat(t) {
|
function test_toFloat(t) {
|
||||||
|
|||||||
@@ -1,102 +1,64 @@
|
|||||||
<html>
|
function com_test_getRenderedDimensions(t) {
|
||||||
<head>
|
t.plan(17);
|
||||||
<style type="text/css">
|
var content = (new Array(100)).join("foo ");
|
||||||
.testDims p{
|
|
||||||
padding: 20px;
|
// test with fixed width
|
||||||
}
|
var fw = OpenLayers.Util.getRenderedDimensions(content, {w: 20});
|
||||||
</style>
|
t.eq(fw.w, 20, "got the fixed width");
|
||||||
<script src="../../lib/OpenLayers.js"></script>
|
|
||||||
<script>
|
// test with fixed height
|
||||||
function run() {
|
var fh = OpenLayers.Util.getRenderedDimensions(content, {h: 15});
|
||||||
var out = document.getElementById("out");
|
t.eq(fh.h, 15, "got the fixed height");
|
||||||
var size = OpenLayers.Util.getRenderedDimensions("<p>Content</p>");
|
|
||||||
var bigger = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", null, {displayClass: 'testDims'});
|
var size = OpenLayers.Util.getRenderedDimensions("<p>Content</p>");
|
||||||
var overflow = OpenLayers.Util.getRenderedDimensions("<p style='overflow:auto'>Content</p>");
|
var bigger = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", null, {displayClass: 'test_getRenderedDimensions'});
|
||||||
var width = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", new OpenLayers.Size(250, null));
|
var overflow = OpenLayers.Util.getRenderedDimensions("<p style='overflow:auto'>Content</p>");
|
||||||
var height = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", new OpenLayers.Size(null, 40));
|
var width = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", new OpenLayers.Size(250, null));
|
||||||
if ((size.w + 40) == bigger.w && (size.h + 40) == bigger.h) {
|
var height = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", new OpenLayers.Size(null, 40));
|
||||||
out.innerHTML = "bigger Pass: " + size + ", " + bigger;
|
t.ok((size.w + 40) == bigger.w && (size.h + 40) == bigger.h, "bigger Pass: " + size + ", " + bigger);
|
||||||
} else {
|
t.ok(size.w == overflow.w && size.h == overflow.h, "overflow Pass: " + size + ", " + overflow);
|
||||||
out.innerHTML = "bigger Fail: " + size + ", " + bigger;
|
t.ok(width.w == 250 && width.h == size.h, "width Pass: " + size + ", " + width);
|
||||||
}
|
t.ok(height.h == 40 && height.w == size.w, "height Pass: " + size + ", " + height);
|
||||||
|
|
||||||
if (size.w == overflow.w && size.h == overflow.h) {
|
content = (new Array(10)).join("foo foo foo <br>");
|
||||||
out.innerHTML += "<br/>overflow Pass: " + size + ", " + overflow;
|
var testName,
|
||||||
} else {
|
finalSize,
|
||||||
out.innerHTML += "<br/>overflow Fail: " + size + ", " + overflow;
|
initialSize = OpenLayers.Util.getRenderedDimensions(content, null);
|
||||||
}
|
// containerElement option on absolute position with width and height
|
||||||
|
testName = "Absolute with w&h: ";
|
||||||
if (width.w == 250 && width.h == size.h) {
|
var optionAbsDiv ={
|
||||||
out.innerHTML += "<br/>width Pass: " + size + ", " + width;
|
containerElement: document.getElementById("absoluteDiv")
|
||||||
}
|
};
|
||||||
else {
|
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv);
|
||||||
out.innerHTML += "<br/>width Fail: " + size + ", " + width;
|
t.ok(initialSize.w > 0 && initialSize.h > 0, "Has initial size (requires visible test_iframe)");
|
||||||
}
|
t.eq(finalSize.w, initialSize.w,
|
||||||
|
testName + "initial width " + initialSize.w + "px is maintained");
|
||||||
if (height.h == 40 && height.w == size.w) {
|
t.eq(finalSize.h, initialSize.h,
|
||||||
out.innerHTML += "<br/>height Pass: " + size + ", " + height;
|
testName + "initial height " + initialSize.h + "px is maintained");
|
||||||
}
|
testName = "Absolute with w&h (set height): ";
|
||||||
else {
|
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv);
|
||||||
out.innerHTML += "<br/>height Fail: " + size + ", " + height;
|
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
|
||||||
}
|
t.eq(finalSize.w, initialSize.w,
|
||||||
|
testName + "initial width " + initialSize.w + "px is maintained");
|
||||||
// To use the same syntax as in "\tests"
|
testName = "Absolute with w&h (set width): ";
|
||||||
var t = {eq: function(a, b, msg) {
|
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv);
|
||||||
if (a == b) {
|
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
|
||||||
out.innerHTML += "<br/>ok " + msg;
|
// containerElement option on absolute position without width and height
|
||||||
}
|
testName = "Absolute without w&h: ";
|
||||||
else {
|
var optionAbsDiv00 ={
|
||||||
out.innerHTML += "<br/><span style=\"color:red\">Fail (" + a + " not eq " + b + "): " + msg + "<span>";
|
containerElement: document.getElementById("absoluteDiv00")
|
||||||
}
|
};
|
||||||
}
|
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv00);
|
||||||
};
|
t.eq(finalSize.w, initialSize.w,
|
||||||
var text = (new Array(10)).join("foo foo foo <br>"),
|
testName + "initial width " + initialSize.w + "px is maintained");
|
||||||
content = "<div>" + text + "</div>";
|
t.eq(finalSize.h, initialSize.h,
|
||||||
var testName,
|
testName + "initial height " + initialSize.h + "px is maintained");
|
||||||
finalSize,
|
testName = "Absolute without w&h (set height): ";
|
||||||
initialSize = OpenLayers.Util.getRenderedDimensions(content, null);
|
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv00);
|
||||||
// containerElement option on absolute position with width and height
|
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
|
||||||
testName = "Absolute with w&h: ";
|
t.eq(finalSize.w, initialSize.w,
|
||||||
var optionAbsDiv ={
|
testName + "initial width " + initialSize.w + "px is maintained");
|
||||||
containerElement: document.getElementById("absoluteDiv")
|
testName = "Absolute without w&h (set width): ";
|
||||||
};
|
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv00);
|
||||||
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv);
|
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
|
||||||
t.eq(finalSize.w, initialSize.w,
|
}
|
||||||
testName + "initial width " + initialSize.w + "px is maintained");
|
|
||||||
t.eq(finalSize.h, initialSize.h,
|
|
||||||
testName + "initial height " + initialSize.h + "px is maintained");
|
|
||||||
testName = "Absolute with w&h (set height): ";
|
|
||||||
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv);
|
|
||||||
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
|
|
||||||
t.eq(finalSize.w, initialSize.w,
|
|
||||||
testName + "initial width " + initialSize.w + "px is maintained");
|
|
||||||
testName = "Absolute with w&h (set width): ";
|
|
||||||
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv);
|
|
||||||
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
|
|
||||||
// containerElement option on absolute position without width and height
|
|
||||||
testName = "Absolute without w&h: ";
|
|
||||||
var optionAbsDiv00 ={
|
|
||||||
containerElement: document.getElementById("absoluteDiv00")
|
|
||||||
};
|
|
||||||
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv00);
|
|
||||||
t.eq(finalSize.w, initialSize.w,
|
|
||||||
testName + "initial width " + initialSize.w + "px is maintained");
|
|
||||||
t.eq(finalSize.h, initialSize.h,
|
|
||||||
testName + "initial height " + initialSize.h + "px is maintained");
|
|
||||||
testName = "Absolute without w&h (set height): ";
|
|
||||||
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv00);
|
|
||||||
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
|
|
||||||
t.eq(finalSize.w, initialSize.w,
|
|
||||||
testName + "initial width " + initialSize.w + "px is maintained");
|
|
||||||
testName = "Absolute without w&h (set width): ";
|
|
||||||
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv00);
|
|
||||||
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body onload="run()">
|
|
||||||
<div id="out"></div>
|
|
||||||
<div id="absoluteDiv" style="position:absolute; left:10px; width:500px; height: 500px"></div>
|
|
||||||
<div id="absoluteDiv00" style="position:absolute; left:10px;"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
35
tests/Util_w3c.html
Normal file
35
tests/Util_w3c.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<style type="text/css">
|
||||||
|
.test_getRenderedDimensions p{
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
var OpenLayers = [
|
||||||
|
"OpenLayers/BaseTypes/Class.js",
|
||||||
|
"OpenLayers/Util.js",
|
||||||
|
"OpenLayers/BaseTypes.js",
|
||||||
|
"OpenLayers/BaseTypes/Element.js",
|
||||||
|
"OpenLayers/BaseTypes/LonLat.js",
|
||||||
|
"OpenLayers/BaseTypes/Pixel.js",
|
||||||
|
"OpenLayers/BaseTypes/Size.js",
|
||||||
|
"OpenLayers/Lang.js",
|
||||||
|
"OpenLayers/Console.js"
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
<script src="OLLoader.js"></script>
|
||||||
|
<script src="Util_common.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function test_getRenderedDimensions(t) {
|
||||||
|
// from <script src="Util_common.js"> and shared by Util.html
|
||||||
|
com_test_getRenderedDimensions(t);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" style="width: 1024px; height: 512px;"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
<li>SingleFile1.html</html>
|
<li>SingleFile1.html</html>
|
||||||
<li>SingleFile2.html</html>
|
<li>SingleFile2.html</html>
|
||||||
<li>SingleFile3.html</html>
|
<li>SingleFile3.html</html>
|
||||||
<li>Popup.html</li>
|
<li>Popup.html?visible</li>
|
||||||
<li>Popup/Anchored.html</li>
|
<li>Popup/Anchored.html</li>
|
||||||
<li>Popup/FramedCloud.html</li>
|
<li>Popup/FramedCloud.html</li>
|
||||||
<li>Projection.html</li>
|
<li>Projection.html</li>
|
||||||
@@ -233,7 +233,8 @@
|
|||||||
<li>TileManager.html</li>
|
<li>TileManager.html</li>
|
||||||
<li>Tween.html</li>
|
<li>Tween.html</li>
|
||||||
<li>Kinetic.html</li>
|
<li>Kinetic.html</li>
|
||||||
<li>Util.html</li>
|
<li>Util.html?visible</li>
|
||||||
|
<li>Util_w3c.html?visible</li>
|
||||||
<li>Util/vendorPrefix.html</li>
|
<li>Util/vendorPrefix.html</li>
|
||||||
<li>WPSClient.html</li>
|
<li>WPSClient.html</li>
|
||||||
<li>WPSProcess.html</li>
|
<li>WPSProcess.html</li>
|
||||||
|
|||||||
@@ -92,11 +92,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span>
|
||||||
|
<iframe id="test_iframe_el" style="display:none" name="test_iframe" onload="Test.AnotherWay._test_page_onload();">
|
||||||
|
</iframe>
|
||||||
|
</span>
|
||||||
<span style="display:none">
|
<span style="display:none">
|
||||||
<iframe name="list_iframe" onload="Test.AnotherWay._list_iframe_onload();">
|
<iframe name="list_iframe" onload="Test.AnotherWay._list_iframe_onload();">
|
||||||
</iframe>
|
</iframe>
|
||||||
<iframe name="test_iframe" onload="Test.AnotherWay._test_page_onload();">
|
|
||||||
</iframe>
|
|
||||||
<!-- record_control div is to be imported into other documents, so all its styles are inline -->-
|
<!-- record_control div is to be imported into other documents, so all its styles are inline -->-
|
||||||
<div id="record_control" style="position:absolute;bottom:0;left:0;margin:0;padding:0.5em;width:22em;height:22em;border:1px solid;background:#ffd;font: normal normal 8pt sans-serif; color:#000; text-align: left">
|
<div id="record_control" style="position:absolute;bottom:0;left:0;margin:0;padding:0.5em;width:22em;height:22em;border:1px solid;background:#ffd;font: normal normal 8pt sans-serif; color:#000; text-align: left">
|
||||||
<p style="margin:0 0 0 0; padding:0">
|
<p style="margin:0 0 0 0; padding:0">
|
||||||
|
|||||||
Reference in New Issue
Block a user