Browse Source

Add 'overflow: hidden' test

Michael Ragazzon 5 years ago
parent
commit
6792c7a0a3

+ 63 - 0
Tests/Data/VisualTests/overflow_hidden.rml

@@ -0,0 +1,63 @@
+<rml>
+<head>
+    <title>Overflow: hidden</title>
+    <link type="text/rcss" href="../style.rcss"/>
+    <link rel="match" href="reference/overflow_hidden-ref.rml"/>
+	<link rel="help" href="https://www.w3.org/TR/CSS21/visufx.html#propdef-overflow" />
+	<meta name="Description" content="Nesting divs should still hide overflow. Elements whose containing block is located above the 'overflow: hidden' element should be visible." />
+	<meta name="See also" content="CSS 2.1 'clipping-' and 'overflow-' tests." />
+	<style>
+		body {
+			display: block;
+			background: #ddd;
+			color: #444;
+		}
+		div.overflow {
+			border: 1px black;
+			overflow: hidden;
+			width: 200px;
+			height: 200px;
+		}
+		div.relative {
+			position: relative;
+		}
+		div.wide {
+			width: 300px;
+			height: 20px;
+			color: #f00;
+			text-align: right;
+			background-color: #aaa;
+		}
+		div.absolute {
+			position: absolute;
+			top: 100px;
+			left: 250px;
+			width: 80px;
+			height: 80px;
+		}
+		.green { background-color: #7f7; }
+		.red { background-color: #f77; }
+	</style>
+</head>
+
+<body>
+<p>There should be a green box, no red visible, and the word 'fail' should not appear.</p>
+<div class="overflow">
+<!-- Nesting an extra div appears to break overflow in RmlUi. Setting it to 'display: inline' appears to make it work correctly. -->
+	<div>
+		<div class="wide">FAIL</div>
+		LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
+		<!-- This should be visible as the containing block should be 'body' which is above 'div.overflow'. -->
+		<div class="absolute green">Should be visible</div>
+	</div>
+</div>
+<div class="overflow relative">
+	<div>
+		<div class="wide">FAIL</div>
+		LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
+		<!-- This should not be visible as the containing block should now be 'div.overflow' since it uses position: relative. -->
+		<div class="absolute red">Should not be visible</div>
+	</div>
+</div>
+</body>
+</rml>

+ 52 - 0
Tests/Data/VisualTests/reference/overflow_hidden-ref.rml

@@ -0,0 +1,52 @@
+<rml>
+<head>
+    <title>Overflow: hidden</title>
+    <link type="text/rcss" href="../../style.rcss"/>
+	<style>
+		body {
+			display: block;
+			background: #ddd;
+			color: #444;
+		}
+		div.overflow {
+			border: 1px black;
+			overflow: hidden;
+			width: 200px;
+			height: 200px;
+		}
+		div.relative {
+			position: relative;
+		}
+		div.wide {
+			width: 300px;
+			height: 20px;
+			color: #f00;
+			text-align: right;
+			background-color: #aaa;
+		}
+		div.absolute {
+			position: absolute;
+			top: 100px;
+			left: 250px;
+			width: 80px;
+			height: 80px;
+		}
+		.green { background-color: #7f7; }
+		.red { background-color: #f77; }
+	</style>
+</head>
+
+<body>
+<p>There should be a green box, no red visible, and the word 'fail' should not appear.</p>
+<div class="overflow">
+	<div class="wide">FAIL</div>
+	LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
+</div>
+<div class="absolute green">Should be visible</div>
+<div class="overflow relative">
+	<div class="wide">FAIL</div>
+	LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
+	<div class="absolute red">Should not be visible</div>
+</div>
+</body>
+</rml>

+ 1 - 5
Tests/Source/VisualTests/TestViewer.cpp

@@ -234,10 +234,6 @@ bool TestViewer::LoadTest(const Rml::String& directory, const Rml::String& filen
 		if (!document_test)
 			return false;
 
-		document_test->UpdateDocument();
-		document_test->SetProperty(PropertyId::Clear, Property(Style::Clear::Both));
-		document_test->UpdateDocument();
-
 		document_test->Show(ModalFlag::None, FocusFlag::None);
 
 		for (const LinkItem& item : link_handler->GetLinkList())
@@ -323,7 +319,7 @@ bool TestViewer::LoadTest(const Rml::String& directory, const Rml::String& filen
 		for (const MetaItem& item : meta_handler->GetMetaList())
 		{
 			rml_description += "<h3>" + item.name + "</h3>";
-			rml_description += "<p style=\"min-height: 120px;\">" + item.content + "</p>";
+			rml_description += "<p>" + item.content + "</p>";
 		}
 
 		Element* description_content = document_description->GetElementById("content");