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
......@@ -46,9 +46,9 @@
</head>
<body onload="init()">
<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>
<div id="block2"></div>
<iframe allowfullscreen src="resources/inner.html" id="block1"></iframe>
<iframe allowfullscreen src="resources/empty.html" id="block1"></iframe>
</body>
</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>
<style>
#float {
......@@ -25,46 +29,35 @@
<div id="clear" />
<span id="two">Two</span>
<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:
if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
var oneState = {'offsetLeft': one.offsetLeft, 'offsetTop': one.offsetTop };
var twoState = {'offsetLeft': two.offsetLeft, 'offsetTop': two.offsetTop };
var callback;
var fullscreenChanged = function(event)
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
document.onwebkitfullscreenchange = fullscreenChanged;
var div = document.getElementById('float');
var div = document.getElementById("float");
var divEnteredFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", div);
testExpected("one.offsetLeft", oneState.offsetLeft);
testExpected("one.offsetTop", oneState.offsetTop);
testExpected("two.offsetLeft", twoState.offsetLeft);
testExpected("two.offsetTop", twoState.offsetTop);
var divEnteredFullScreen = function()
{
if (document.webkitCurrentFullScreenElement == div) {
callback = cancelledFullScreen;
runWithKeyDown(function(){document.webkitCancelFullScreen()});
}
};
var cancelledFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", null);
testExpected("one.offsetLeft", oneState.offsetLeft);
testExpected("one.offsetTop", oneState.offsetTop);
testExpected("two.offsetLeft", twoState.offsetLeft);
testExpected("two.offsetTop", twoState.offsetTop);
var cancelledFullScreen = function()
{
if (document.webkitCurrentFullScreenElement == null) {
callback = null;
endTest();
}
};
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() {
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
document.onwebkitfullscreenchange = fullscreenChanged;
var one = document.getElementById('one');
var two = document.getElementById('two');
var three = document.getElementById('three');
var threeEnteredFullScreen = function(event) {
if (document.webkitCurrentFullScreenElement == three) {
callback = threeExitedFullScreen;
testExpected("document.webkitCurrentFullScreenElement", three);
one.removeChild(two);
}
};
var threeExitedFullScreen = function(event) {
if (document.webkitCurrentFullScreenElement == null) {
callback = null;
testExpected("document.webkitCurrentFullScreenElement", null);
endTest();
}
};
callback = threeEnteredFullScreen;
runWithKeyDown(function(){three.webkitRequestFullScreen()});
function goFullScreen() {
document.getElementById('three').webkitRequestFullScreen();
}
runWithKeyDown(goFullScreen);
}
};
var startTest = function() { document.getElementById('three').webkitRequestFullScreen(); };
</script>
<script src="full-screen-test.js"></script>
<style>
......@@ -64,12 +69,11 @@ var startTest = function() { document.getElementById('three').webkitRequestFullS
</head>
<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="two">
<div id="three"></div>
</div>
</div>
</script>
</body>
<!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 @@
<video id="video"></video>
</div>
</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
......@@ -7,23 +7,19 @@
function init() {
// Bail out early if the full screen API is not enabled or is missing:
if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
logResult(false, 'Element.prototype.webkitRequestFullScreen == undefined');
endTest();
} else {
waitForEvent(document, 'webkitfullscreenchange', function() {
if (document.webkitIsFullScreen)
runWithKeyDown(function() { document.webkitCancelFullScreen(); });
else {
endTest();
document.onwebkitfullscreenchange = function() {
document.onwebkitfullscreenchange = endTest;
document.webkitCancelFullScreen();
};
function goFullScreen() {
document.getElementById('block1').webkitRequestFullScreen();
}
});
runWithKeyDown(goFullScreen);
}
}
function goFullScreen() {
document.getElementById('block1').webkitRequestFullScreen();
}
</script>
<script src="full-screen-test.js"></script>
<style>
......@@ -58,3 +54,4 @@
<div id="block1"></div>
</div>
</body>
</html>
<body>
<button onclick="document.documentElement.webkitRequestFullScreen()">Go full screen</button>
</body>
<!DOCTYPE html>
<button onclick="document.documentElement.webkitRequestFullScreen()">Go full screen</button>
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