Bug 1309407 - [css-grid] Reftest for track flex max-sizing with min/max-sizes.

This commit is contained in:
Mats Palmgren 2016-10-19 04:20:48 +02:00
Родитель 32e97d17ca
Коммит 5c23ea1c25
5 изменённых файлов: 428 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,110 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: Testing track flex max-sizing with min/max</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309407">
<style type="text/css">
.grid {
display: grid;
border:1px dashed;
margin: 3px;
}
.rows {
float: left;
grid: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px;
grid-row-gap: 33px;
}
.cols {
display: inline-grid;
grid: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr);
grid-column-gap: 33px;
}
.item:nth-child(1) { background-color: purple; }
.item:nth-child(2) { background-color: blue; }
.w70 { width: 70px; }
.w90 { width: 90px; }
.h70 { height: 70px; }
.h90 { height: 90px; }
</style>
</head><body>
<!--
NOTE: The resulting size (in the relevant axis) is 83px for all tests below
in the "If the free space is an indefinite length" algo here:
https://drafts.csswg.org/css-grid/#algo-flex-tracks
These tests verifies that we then also apply min/max sizes per the spec:
"If using this flex fraction would cause the grid to be smaller than the grid
containers min-width/height (or larger than the grid containers max-width/
height), then redo this step, treating the free space as definite and the
available grid space as equal to the grid containers content box size when
its sized to its min-width/height (max-width/height)."
-->
<pre>These grids should look the same:</pre>
<div class="grid rows h70" style="max-height:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows h70" style="min-height:70px; max-height:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows h70" style="height:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>These grids should look the same:</pre>
<div class="grid rows h90" style="min-height:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows h90" style="min-height:90px; max-height:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows h90" style="height:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>These grids should look the same:</pre>
<div class="grid cols w70" style="max-width:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols w70" style="min-width:70px; max-width:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols w70" style="width:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<pre>These grids should look the same:</pre>
<div class="grid cols w90" style="min-width:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols w90" style="min-width:90px; max-width:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols w90" style="width:90px">
<div class="item"></div>
<div class="item"></div>
</div>
</body></html>

Просмотреть файл

@ -0,0 +1,108 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: Testing track flex max-sizing with min/max</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309407">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/#algo-flex-tracks">
<link rel="match" href="grid-max-sizing-flex-007-ref.html">
<style type="text/css">
.grid {
display: grid;
border:1px dashed;
margin: 3px;
}
.rows {
float: left;
grid: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px;
grid-row-gap: 33px;
}
.cols {
display: inline-grid;
grid: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr);
grid-column-gap: 33px;
}
.item:nth-child(1) { background-color: purple; }
.item:nth-child(2) { background-color: blue; }
</style>
</head><body>
<!--
NOTE: The resulting size (in the relevant axis) is 83px for all tests below
in the "If the free space is an indefinite length" algo here:
https://drafts.csswg.org/css-grid/#algo-flex-tracks
These tests verifies that we then also apply min/max sizes per the spec:
"If using this flex fraction would cause the grid to be smaller than the grid
containers min-width/height (or larger than the grid containers max-width/
height), then redo this step, treating the free space as definite and the
available grid space as equal to the grid containers content box size when
its sized to its min-width/height (max-width/height)."
-->
<pre>These grids should look the same:</pre>
<div class="grid rows" style="max-height:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="min-height:70px; max-height:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="height:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>These grids should look the same:</pre>
<div class="grid rows" style="min-height:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="min-height:90px; max-height:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="height:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>These grids should look the same:</pre>
<div class="grid cols" style="max-width:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="min-width:70px; max-width:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="width:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<pre>These grids should look the same:</pre>
<div class="grid cols" style="min-width:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="min-width:90px; max-width:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="width:90px">
<div class="item"></div>
<div class="item"></div>
</div>
</body></html>

Просмотреть файл

@ -0,0 +1,111 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: Testing track flex max-sizing</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309407">
<style type="text/css">
.grid {
display: grid;
border:1px dashed;
margin: 3px;
}
.rows {
float: left;
grid: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px;
grid-row-gap: 33px;
}
.rows-min {
float: left;
grid: 10px 10px / 50px;
grid-row-gap: 33px;
}
.cols {
display: inline-grid;
grid: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr);
grid-column-gap: 33px;
}
.cols-min {
display: inline-grid;
grid: 50px / 10px 10px;
grid-column-gap: 33px;
}
.item:nth-child(1) { background-color: purple; }
.item:nth-child(2) { background-color: blue; }
.w70 { width: 70px; }
.w90 { width: 90px; }
.h70 { height: 70px; }
.h90 { height: 90px; }
</style>
</head><body>
<pre>First four are without min/max-sizes:</pre>
<div style="float:left">
<div class="grid rows">
<div class="item"></div>
<div class="item"></div>
</div>
</div>
<div style="height:100px; margin-bottom:-100px">
<div class="grid rows">
<div class="item"></div>
<div class="item"></div>
</div>
</div>
<div style="display:inline-block; width:100px; margin-right:-9px">
<div class="grid cols">
<div class="item"></div>
<div class="item"></div>
</div>
</div>
<div class="grid cols-min" style="width:53px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>Max-size less than grid-gap:</pre>
<div class="grid rows-min" style="height:0px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows-min" style="max-height:0px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows-min" style="height:20px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows-min" style="max-height:20px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows-min" style="height:33px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all" style="margin-top:40px; ">
<div class="grid cols-min" style="width:20px; margin-right:30px;">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols-min" style="width:20px; margin-right:30px;">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols-min" style="width:33px; margin-right:30px;">
<div class="item"></div>
<div class="item"></div>
</div>
</body></html>

Просмотреть файл

@ -0,0 +1,97 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: Testing track flex max-sizing</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309407">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/#algo-flex-tracks">
<link rel="match" href="grid-max-sizing-flex-008-ref.html">
<style type="text/css">
.grid {
display: grid;
border:1px dashed;
margin: 3px;
}
.rows {
float: left;
grid: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px;
grid-row-gap: 33px;
}
.cols {
display: inline-grid;
grid: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr);
grid-column-gap: 33px;
}
.item:nth-child(1) { background-color: purple; }
.item:nth-child(2) { background-color: blue; }
</style>
</head><body>
<pre>First four are without min/max-sizes:</pre>
<div class="grid rows">
<div class="item"></div>
<div class="item"></div>
</div>
<div style="height:0">
<div class="grid rows">
<div class="item"></div>
<div class="item"></div>
</div>
</div>
<div class="grid cols">
<div class="item"></div>
<div class="item"></div>
</div>
<div style="display:inline-block; width:0">
<div class="grid cols">
<div class="item"></div>
<div class="item"></div>
</div>
</div>
<br clear="all">
<pre>Max-size less than grid-gap:</pre>
<div class="grid rows" style="height:0px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="max-height:0px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="height:20px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="max-height:20px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="height:33px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all" style="margin-top:40px; ">
<div class="grid cols" style="max-width:20px; margin-right:30px;">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="width:20px; margin-right:30px;">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="width:33px; margin-right:30px;">
<div class="item"></div>
<div class="item"></div>
</div>
</body></html>

Просмотреть файл

@ -70,6 +70,8 @@ skip-if(Android) == grid-auto-min-sizing-percent-001.html grid-auto-min-sizing-p
== grid-max-sizing-flex-004.html grid-max-sizing-flex-004-ref.html
== grid-max-sizing-flex-005.html grid-max-sizing-flex-005-ref.html
== grid-max-sizing-flex-006.html grid-max-sizing-flex-006-ref.html
== grid-max-sizing-flex-007.html grid-max-sizing-flex-007-ref.html
== grid-max-sizing-flex-008.html grid-max-sizing-flex-008-ref.html
== grid-flex-min-sizing-001.html grid-flex-min-sizing-001-ref.html
== grid-flex-min-sizing-002.html grid-flex-min-sizing-002-ref.html
== grid-item-align-001.html grid-item-align-001-ref.html