Przeglądaj źródła

Add visual tests for media query

Michael Ragazzon 5 lat temu
rodzic
commit
7e9981da93

+ 100 - 0
Tests/Data/VisualTests/media_query_01.rml

@@ -0,0 +1,100 @@
+<rml>
+<head>
+    <title>Media query: Collapsing menu</title>
+    <link type="text/rcss" href="../style.rcss"/>
+	<meta name="Description" content="A basic responsive design for a collapsing menu." />
+	<style>
+		@spritesheet theme 
+		{
+			src: /assets/invader.tga;
+			selectarrow: 307px 192px 30px 37px;
+			selectarrow-hover: 307px 230px 30px 37px;
+			selectarrow-active: 307px 268px 30px 37px;
+		}
+		body {
+			background: #ddd;
+			color: #444;
+			right: 440px;
+			width: -1px;
+			left: 0px;
+		}
+		item {
+			background: #fff;
+			font-size: 1.2em;
+			padding: 1em;
+			border: 3px #ccc;
+			cursor: pointer;
+		}
+		item:hover {
+			background: #eee;
+		}
+		item:active {
+			background: #e0e0e0;
+		}
+		
+		@media (min-width: 1000px)
+		{
+			menu {
+				display: table;
+				focus: none;
+			}
+			items {
+				display: table-row;
+			}
+			item {
+				display: table-cell;
+				text-align: center;
+				border-right-width: 0;
+			}
+			item:last-child {
+				border-right-width: 3px;
+			}
+		}
+
+		@media (max-width: 999px)
+		{
+			menu {
+				display: block;
+				width: 100%;
+				min-width: 100px;
+				height: 37px;
+				cursor: pointer;
+				decorator: image(selectarrow contain left);
+			}
+			menu:hover {
+				decorator: image(selectarrow-hover contain left);
+			}
+			menu:active, menu:focus {
+				decorator: image(selectarrow-active contain left);
+			}
+			items {
+				display: none;
+				padding-top: 37px;
+				z-index: 10;
+			}
+			menu:focus items {
+				display: block;
+			}
+			item {
+				display: block;
+				border-bottom-width: 0;
+			}
+			item:last-child {
+				border-bottom-width: 3px;
+			}
+		}
+	</style>
+</head>
+
+<body>
+<menu>
+	<items>
+		<item>Home</item>
+		<item>Blog</item>
+		<item>About</item>
+		<item>Contact</item>
+	</items>
+</menu>
+<p>Try reducing the width of the window.</p>
+</body>
+</rml>

+ 58 - 0
Tests/Data/VisualTests/media_query_02.rml

@@ -0,0 +1,58 @@
+<rml>
+<head>
+    <title>Media query: Sprite sheets</title>
+    <link type="text/rcss" href="../style.rcss"/>
+	<meta name="Description" content="Spritesheets located within media blocks.<br/><br/>Try reducing the width of the window to see the icon and image change, and adjust the dp-ratio with Ctrl +/-/0." />
+	<style>
+		body {
+			background: #ddd;
+			color: #444;
+			right: 440px;
+			width: -1px;
+			left: 0px;
+		}
+		icon {
+			display: block;
+			decorator: image(icon scale-none);
+			width: 64px;
+			height: 64px;
+		}
+
+		@spritesheet
+		{
+			src: /assets/invader.tga;
+			icon: 332px 152px 51px 39px; /* icon-waves */
+		}
+		@media (min-width: 1000px)
+		{
+			@spritesheet
+			{
+				src: /assets/invader.tga;
+				icon: 179px 152px 51px 39px; /* icon-invader */
+			}
+		}
+		@media (min-width: 1300px)
+		{
+			@spritesheet
+			{
+				src: /assets/invader.tga;
+				icon: 230px 152px 51px 39px; /* icon-game */
+			}
+		}
+		@media (min-resolution: 2x)
+		{
+			@spritesheet
+			{
+				src: /assets/high_scores_alien_1.tga;
+				icon: 0px 0px 64px 64px;
+				resolution: 2x;
+			}
+		}
+	</style>
+</head>
+
+<body>
+<icon/>
+<img sprite="icon"/>
+</body>
+</rml>