From c2f23ccd230a0dce89848cee987974f277b2aa06 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 13 May 2011 02:41:21 +0200 Subject: [PATCH] reftests: Add a shell script to create tests See the documentation in the script. Tests are not yet added as the output from the 2 included scripts doesn't match and the intended reference output first needs to be agreed on. --- tests/reftests/Makefile.am | 1 + tests/reftests/align-expand.sh | 222 +++++++++++++++++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100755 tests/reftests/align-expand.sh diff --git a/tests/reftests/Makefile.am b/tests/reftests/Makefile.am index fe8c390e73..463e45d826 100644 --- a/tests/reftests/Makefile.am +++ b/tests/reftests/Makefile.am @@ -25,6 +25,7 @@ clean-local: rm -rf output/ || true EXTRA_DIST += \ + align-expand.sh \ box-packing.css \ box-packing.ref.ui \ box-packing.ui \ diff --git a/tests/reftests/align-expand.sh b/tests/reftests/align-expand.sh new file mode 100755 index 0000000000..4e61f4adb5 --- /dev/null +++ b/tests/reftests/align-expand.sh @@ -0,0 +1,222 @@ +#!/bin/bash +# +# align-expand.sh [METHOD] +# +# This is the script used to create the align-expand tests. These tests +# put a 20x20 size-requested GtkTreeView into a 40x40 size-requested +# container and try to achieve multiple combinations of expand and align +# flags. The resulting GtkBuilder file is written to stdout. All of the +# resulting files should render identical. +# +# METHOD is one of: +# * flags (default) +# Uses expand flags to align and expand the treeview inside a GtkGrid. +# You should use this as the reference when adding tests for other +# methods +# * alignment +# Aligns and expands the treeview in a GtkAlignment using its scale +# and align properties. + + +if test $# -lt 1; then + method="flags" +else + method=$1 +fi + +cat << EOF + + + + + False + popup + + + True + False + 2 + 2 +EOF + + +y=2 +for hexpand in False True; do +for halign in "start" center end fill; do + +cat << EOF + + + True + False + $hexpand + 90 + + + $y + 0 + 1 + 1 + + + + + True + False + $halign + 90 + + + $y + 1 + 1 + 1 + + +EOF +x=2 +for vexpand in False True; do +for valign in "start" center end fill; do + +if test $y = "2"; then +cat << EOF + + + True + False + $vexpand + + + 0 + $x + 1 + 1 + + + + + True + False + $valign + + + 1 + $x + 1 + 1 + + +EOF +fi + +if test $method = "flags"; then + +cat << EOF + + + 40 + 40 + True + False + + + 20 + 20 + True + False + $halign + $valign + $hexpand + $vexpand + + + 0 + 0 + 1 + 1 + + + + + $x + $y + 1 + 1 + + +EOF + +elif test $method = "alignment"; then + +xscale=0.0 +case "$halign" in + "start") xalign=0.0 ;; + "center") xalign=0.5 ;; + "end") xalign=1.0 ;; + "fill") xalign=0.5; xscale=1.0 ;; +esac +if test $hexpand = "True"; then + xscale=1.0 +fi + +yscale=0.0 +case "$valign" in + "start") yalign=0.0 ;; + "center") yalign=0.5 ;; + "end") yalign=1.0 ;; + "fill") yalign=0.5; yscale=1.0 ;; +esac +if test $vexpand = "True"; then + yscale=1.0 +fi + +cat << EOF + + + 40 + 40 + True + False + $xalign + $yalign + $xscale + $yscale + + + 20 + 20 + True + False + + + + + $x + $y + 1 + 1 + + +EOF + +else + + exit 1 + +fi + +x=`expr $x + 1` +done +done + +y=`expr $y + 1` +x=0 +done +done + +cat << EOF + + + + +EOF