Commit a72aca5f authored by philipj@opera.com's avatar philipj@opera.com

Convert more fullscreen tests to reftests

This removes ~242 KB of *-expected.png and leaves only a few
platform-specific expectations left in
LayoutTests/platform/linux/virtual/android/fullscreen/

Some tests were simultaneously pixel tests and text tests, which is
not great for a reftest. To avoid having the (formated) log output in
*-expected.html, instead make those tests time out if any check fails.

Review URL: https://codereview.chromium.org/457663002

git-svn-id: svn://svn.chromium.org/blink/trunk@180036 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5dbe7568
This tests that an element with a positive z-index appears behind the full screen element. After entering full screen mode, only a white box should be visible. Click go full screen to run the test.
EVENT(webkitfullscreenchange)
END OF TEST
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
</style> </style>
</head> </head>
<body onload="init()"> <body onload="init()">
<div>This tests that an element with a positive z-index appears behind the full screen element. <div>This tests that an element with a positive z-index appears behind the full screen element.
After entering full screen mode, only a white box should be visible. After entering full screen mode, the whole screen should be white.
Click <button onclick="goFullScreen()">go full screen</button> to run the test.</div> Click <button onclick="goFullScreen()">go full screen</button> to run the test.</div>
<div id="block2"></div> <div id="block2"></div>
<iframe allowfullscreen src="resources/inner.html" id="block1"></iframe> <iframe allowfullscreen src="resources/empty.html" id="block1"></iframe>
</body> </body>
</html> </html>
<!DOCTYPE html>
<style>
#float {
margin: 10px 0 0 10px;
height: 50px;
width: 50px;
float: left;
background-color: red;
}
#clear {
clear: left;
}
#one {
background-color: lightblue;
float: left;
}
#two {
background-color: lightgreen;
}
</style>
<div>This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press <button>go full-screen</a> to begin.</div>
<div id="float"></div>
<div id="one">One</div>
<div id="clear"></div>
<span id="two">Two</span>
<div>END OF TEST</div>
<!DOCTYPE html>
<script>
var runPixelTests = true;
</script>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<style> <style>
#float { #float {
margin: 10px 0 0 10px; margin: 10px 0 0 10px;
height: 50px; height: 50px;
width: 50px; width: 50px;
...@@ -10,11 +14,11 @@ ...@@ -10,11 +14,11 @@
#clear { #clear {
clear:left; clear:left;
} }
#one { #one {
background-color: lightblue; background-color: lightblue;
float: left; float: left;
} }
#two { #two {
background-color: lightgreen; background-color: lightgreen;
} }
</style> </style>
...@@ -25,46 +29,35 @@ ...@@ -25,46 +29,35 @@
<div id="clear" /> <div id="clear" />
<span id="two">Two</span> <span id="two">Two</span>
<script> <script>
var one = document.getElementById('one');
var two = document.getElementById('two');
// Bail out early if the full screen API is not enabled or is missing: // Bail out early if the full screen API is not enabled or is missing:
if (Element.prototype.webkitRequestFullScreen == undefined) { if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest(); endTest();
} else { } else {
var oneState = {'offsetLeft': one.offsetLeft, 'offsetTop': one.offsetTop };
var twoState = {'offsetLeft': two.offsetLeft, 'offsetTop': two.offsetTop };
var callback; var callback;
var fullscreenChanged = function(event) var fullscreenChanged = function(event)
{ {
if (callback) if (callback)
callback(event) callback(event)
}; };
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); document.onwebkitfullscreenchange = fullscreenChanged;
var div = document.getElementById('float');
var divEnteredFullScreen = function() { var div = document.getElementById("float");
testExpected("document.webkitCurrentFullScreenElement", div);
testExpected("one.offsetLeft", oneState.offsetLeft); var divEnteredFullScreen = function()
testExpected("one.offsetTop", oneState.offsetTop); {
testExpected("two.offsetLeft", twoState.offsetLeft); if (document.webkitCurrentFullScreenElement == div) {
testExpected("two.offsetTop", twoState.offsetTop); callback = cancelledFullScreen;
callback = cancelledFullScreen; runWithKeyDown(function(){document.webkitCancelFullScreen()});
runWithKeyDown(function(){document.webkitCancelFullScreen()}); }
}; };
var cancelledFullScreen = function() { var cancelledFullScreen = function()
testExpected("document.webkitCurrentFullScreenElement", null); {
testExpected("one.offsetLeft", oneState.offsetLeft); if (document.webkitCurrentFullScreenElement == null) {
testExpected("one.offsetTop", oneState.offsetTop); callback = null;
testExpected("two.offsetLeft", twoState.offsetLeft); endTest();
testExpected("two.offsetTop", twoState.offsetTop); }
callback = null;
endTest();
}; };
callback = divEnteredFullScreen; callback = divEnteredFullScreen;
......
<!DOCTYPE html>
<style>
#one {
border: 4px solid darkgreen;
background-color: green;
width: 600px;
height: 400px;
padding: 4px;
}
</style>
This tests that, if the ancestor of the current full-screen element is removed, full screen mode will exit, and the document will render normally. At the completion of the test, a green box should be visible. Click <button>go full screen</button> to run the test.
<div id="one"></div>
<div>END OF TEST</div>
This tests that, if the ancestor of the current full-screen element is removed, full screen mode will exit, and the document will render normally. At the completion of the test, a green box should be visible. Click go full screen to run the test.
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
END OF TEST
...@@ -13,29 +13,34 @@ var init = function() { ...@@ -13,29 +13,34 @@ var init = function() {
if (callback) if (callback)
callback(event) callback(event)
}; };
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); document.onwebkitfullscreenchange = fullscreenChanged;
var one = document.getElementById('one'); var one = document.getElementById('one');
var two = document.getElementById('two'); var two = document.getElementById('two');
var three = document.getElementById('three'); var three = document.getElementById('three');
var threeEnteredFullScreen = function(event) { var threeEnteredFullScreen = function(event) {
callback = threeExitedFullScreen; if (document.webkitCurrentFullScreenElement == three) {
testExpected("document.webkitCurrentFullScreenElement", three); callback = threeExitedFullScreen;
one.removeChild(two); one.removeChild(two);
}
}; };
var threeExitedFullScreen = function(event) { var threeExitedFullScreen = function(event) {
callback = null; if (document.webkitCurrentFullScreenElement == null) {
testExpected("document.webkitCurrentFullScreenElement", null); callback = null;
endTest(); endTest();
}
}; };
callback = threeEnteredFullScreen; callback = threeEnteredFullScreen;
runWithKeyDown(function(){three.webkitRequestFullScreen()});
function goFullScreen() {
document.getElementById('three').webkitRequestFullScreen();
}
runWithKeyDown(goFullScreen);
} }
}; };
var startTest = function() { document.getElementById('three').webkitRequestFullScreen(); };
</script> </script>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<style> <style>
...@@ -63,13 +68,12 @@ var startTest = function() { document.getElementById('three').webkitRequestFullS ...@@ -63,13 +68,12 @@ var startTest = function() { document.getElementById('three').webkitRequestFullS
</style> </style>
</head> </head>
<body onload="init()"> <body onload="init()">
This tests that, if the ancestor of the current full-screen element is removed, full screen mode will exit, and the document will render normally. At the completion of the test, a green box should be visible. Click <button onclick="startTest()">go full screen</button> to run the test. This tests that, if the ancestor of the current full-screen element is removed, full screen mode will exit, and the document will render normally. At the completion of the test, a green box should be visible. Click <button onclick="goFullScreen()">go full screen</button> to run the test.
<div id="one"> <div id="one">
<div id="two"> <div id="two">
<div id="three"></div> <div id="three"></div>
</div> </div>
</div> </div>
</body>
</script>
<!DOCTYPE html>
<video></video>
<script>
var runPixelTests = true;
</script>
<script src="full-screen-test.js"></script>
<script>
document.onwebkitfullscreenchange = endTest;
runWithKeyDown(function() {
document.querySelector("video").webkitRequestFullScreen();
});
</script>
This tests that a full screen element in a lower stacking context blocks a sibling in a higher stacking context. After entering full screen mode, only a black box should be visible. Click go full screen to run the test.
EVENT(webkitfullscreenchange)
END OF TEST
...@@ -60,3 +60,4 @@ ...@@ -60,3 +60,4 @@
<video id="video"></video> <video id="video"></video>
</div> </div>
</body> </body>
</html>
<!DOCTYPE html>
<style>
#block1 {
width: 200px;
height: 100px;
border: 4px solid darkgreen;
background-color: green;
}
#block2 {
width: 100px;
height: 50px;
border: 4px solid darkred;
background-color: red;
z-index: 200;
position: relative;
left: 50px;
top: 25px;
}
#block3 {
z-index: 500;
position: relative;
}
</style>
<div>This tests that an element with a positive z-index appears behind the full screen element.
After entering full screen mode, the green box should not be obscured by the red box.
Click <button>go full screen</button> to run the test.</div>
<div id="block2"></div>
<div id="block3">
<div id="block1"></div>
</div>
<div>END OF TEST</div>
This tests that an element with a positive z-index appears behind the full screen element. After entering full screen mode, the green box should not be obscured by the red box. Click go full screen to run the test.
EVENT(webkitfullscreenchange)
EVENT(webkitfullscreenchange)
END OF TEST
...@@ -3,27 +3,23 @@ ...@@ -3,27 +3,23 @@
<head> <head>
<script> <script>
var runPixelTests = true; var runPixelTests = true;
function init() { function init() {
// Bail out early if the full screen API is not enabled or is missing: // Bail out early if the full screen API is not enabled or is missing:
if (Element.prototype.webkitRequestFullScreen == undefined) { if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); logResult(false, 'Element.prototype.webkitRequestFullScreen == undefined');
endTest(); endTest();
} else { } else {
waitForEvent(document, 'webkitfullscreenchange', function() { document.onwebkitfullscreenchange = function() {
if (document.webkitIsFullScreen) document.onwebkitfullscreenchange = endTest;
runWithKeyDown(function() { document.webkitCancelFullScreen(); }); document.webkitCancelFullScreen();
else { };
endTest(); function goFullScreen() {
} document.getElementById('block1').webkitRequestFullScreen();
}); }
runWithKeyDown(goFullScreen); runWithKeyDown(goFullScreen);
} }
} }
function goFullScreen() {
document.getElementById('block1').webkitRequestFullScreen();
}
</script> </script>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<style> <style>
...@@ -50,7 +46,7 @@ ...@@ -50,7 +46,7 @@
</style> </style>
</head> </head>
<body onload="init()"> <body onload="init()">
<div>This tests that an element with a positive z-index appears behind the full screen element. <div>This tests that an element with a positive z-index appears behind the full screen element.
After entering full screen mode, the green box should not be obscured by the red box. After entering full screen mode, the green box should not be obscured by the red box.
Click <button onclick="goFullScreen()">go full screen</button> to run the test.</div> Click <button onclick="goFullScreen()">go full screen</button> to run the test.</div>
<div id="block2"></div> <div id="block2"></div>
...@@ -58,3 +54,4 @@ ...@@ -58,3 +54,4 @@
<div id="block1"></div> <div id="block1"></div>
</div> </div>
</body> </body>
</html>
<body> <!DOCTYPE html>
<button onclick="document.documentElement.webkitRequestFullScreen()">Go full screen</button> <button onclick="document.documentElement.webkitRequestFullScreen()">Go full screen</button>
</body>
This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press go full-screen to begin.
One
Two
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '50') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '110') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '50') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '110') OK
END OF TEST
This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press go full-screen to begin.
One
Two
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '50') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '110') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '50') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '110') OK
END OF TEST
This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press go full-screen to begin.
One
Two
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '45') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '105') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '45') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '105') OK
END OF TEST
This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press go full-screen to begin.
One
Two
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '50') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '110') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '50') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '110') OK
END OF TEST
This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press go full-screen to begin.
One
Two
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '47') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '107') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
EXPECTED (one.offsetLeft == '68') OK
EXPECTED (one.offsetTop == '47') OK
EXPECTED (two.offsetLeft == '8') OK
EXPECTED (two.offsetTop == '107') OK
END OF TEST
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment