]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 21 Aug 2012 11:46:58 +0000 (11:46 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 21 Aug 2012 11:46:58 +0000 (11:46 +0000)
tests/validate-colorspace.tap [new file with mode: 0755]
tests/validate-compare.tap [new file with mode: 0755]
tests/validate-composite.tap [new file with mode: 0755]
tests/validate-convert.tap [new file with mode: 0755]
tests/validate-formats-in-memory.tap [new file with mode: 0755]
tests/validate-formats-on-disk.tap [new file with mode: 0755]
tests/validate-identify.tap [new file with mode: 0755]
tests/validate-import.tap [new file with mode: 0755]
tests/validate-montage.tap [new file with mode: 0755]
tests/validate-pipe.tap [new file with mode: 0755]
tests/validate-stream.tap [new file with mode: 0755]

diff --git a/tests/validate-colorspace.tap b/tests/validate-colorspace.tap
new file mode 100755 (executable)
index 0000000..05d6617
--- /dev/null
@@ -0,0 +1,123 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+depth=`eval ${MAGICK} xc:none -format '%[fx:QuantumRange]' info:-`
+if [ "X$depth" == "X255" ]; then
+  exit 0
+fi
+
+# how to generate a one pixel (average rose) color and output its values
+in="rose: -scale 1x1"    # a one pixel image of the average color.
+out="-format '%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]' info:-"
+
+# ----------------
+
+# Colors to compare results to.
+error=false
+average=`eval ${MAGICK} "$in" -noop "$out"`
+too_dark=`eval ${MAGICK} "$in" -colorspace RGB "$out"`
+too_light=`eval ${MAGICK} "$in" -set colorspace RGB -colorspace sRGB "$out"`
+format='%-30s%s\n'        # results formating
+format2='%-30s%-14s%s\n'
+
+printf "$format2" "Average \"rose:\" Color"  "$average" "sRGB(rose)"
+printf "$format2" "Too Dark Color"  "$too_dark"  "sRGB(rose)->RGB result"
+printf "$format2" "Too Light Color" "$too_light" "RGB(rose)->sRGB result"
+echo ''
+
+#
+# Sanity checks
+#
+# NOTE: as a extra validation on sanity checks below...
+#    eval ${MAGICK} "$in" -gamma .454545 "$out"
+# produces a value of  74,25,20   which is close to 73,26,21 below.
+#    eval ${MAGICK} "$in" -gamma 2.2 "$out"
+# produces a value of  198,158,151  whcih is close to 199,160,152 below.
+#
+# Actual values used below come from IM v6.5.4-7 colorspace conversions
+#
+error=false
+if [ "X$average" != "X146,89,80" ]; then
+  echo "Sanity Failure: Average expected to be 145,89,80 - ABORTING"
+  error=true
+fi
+if [ "X$too_dark" != "X73,26,21" ]; then
+  echo "Sanity Failure: Too Dark expected to be 73,26,21 - ABORTING"
+  error=true
+fi
+if [ "X$too_light" != "X199,160,152" ]; then
+  echo "Sanity Failure: Too Light expected to be 199,160,152 - ABORTING"
+  error=true
+fi
+$error && exit 1
+
+test_color() {
+  test="sRGB"
+  cs='';
+  for i in "$@"; do
+    test="${test}->$i"        # format of the test being performed
+    cs="$cs -colorspace $i"   # colorspace operations to perform test
+  done
+  color=`eval ${MAGICK} "$in" $cs "$out"`
+
+  if [ "X$color" = "X$average" ]; then
+    printf "$format" "$test" "good"
+    return
+  fi
+  # Its failed the round-trip test, now report how it failed!
+  error=true
+  if [ "X$color" = "X$too_light" ]; then
+    printf "$format" "$test" "TOO_LIGHT"
+    return
+  fi
+  if [ "X$color" = "X$too_dark" ]; then
+    printf "$format" "$test" "TOO_DARK"
+    return
+  fi
+  printf "$format" "$test" "UNKNOWN COLOR (expect $average, got $color)"
+}
+
+# ----------------
+
+test_color RGB     sRGB  # round trip (parts tested above)
+
+test_color XYZ     sRGB
+test_color XYZ RGB sRGB
+test_color RGB XYZ sRGB
+
+test_color LAB     sRGB
+test_color XYZ LAB sRGB
+test_color LAB XYZ sRGB
+test_color RGB LAB sRGB
+test_color LAB RGB sRGB
+
+test_color CMY   sRGB
+test_color CMYK  sRGB
+test_color HSL   sRGB
+test_color HSB   sRGB
+test_color HWB   sRGB
+test_color Log   sRGB
+test_color YIQ   sRGB
+test_color YUV   sRGB
+test_color YCbCr sRGB
+test_color OHTA  sRGB
+
+$error && exit 1 # return the overall error result
+exit 0
+:
diff --git a/tests/validate-compare.tap b/tests/validate-compare.tap
new file mode 100755 (executable)
index 0000000..b102c81
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate compare && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-composite.tap b/tests/validate-composite.tap
new file mode 100755 (executable)
index 0000000..dc932e9
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate composite && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-convert.tap b/tests/validate-convert.tap
new file mode 100755 (executable)
index 0000000..54728df
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate convert && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-formats-in-memory.tap b/tests/validate-formats-in-memory.tap
new file mode 100755 (executable)
index 0000000..3825550
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate formats-in-memory && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-formats-on-disk.tap b/tests/validate-formats-on-disk.tap
new file mode 100755 (executable)
index 0000000..19a87e3
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate formats-on-disk && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-identify.tap b/tests/validate-identify.tap
new file mode 100755 (executable)
index 0000000..55e2827
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate identify && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-import.tap b/tests/validate-import.tap
new file mode 100755 (executable)
index 0000000..0e63485
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate import-export && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-montage.tap b/tests/validate-montage.tap
new file mode 100755 (executable)
index 0000000..64199af
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate montage && echo "ok" || echo "not ok"
+:
diff --git a/tests/validate-pipe.tap b/tests/validate-pipe.tap
new file mode 100755 (executable)
index 0000000..3f7d266
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+set -e # Exit on any error
+[ "X$srcdir" = "X" ] && srcdir=`pwd`
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${MAGICK} pnm:- null:   < ${REFERENCE_IMAGE}
+${MAGICK} pnm:- info:   < ${REFERENCE_IMAGE}
+${MAGICK} pnm:- miff:-  < ${REFERENCE_IMAGE} | ${IDENTIFY} -
+${MAGICK} pnm:- -       < ${REFERENCE_IMAGE} | ${IDENTIFY} -
+${MAGICK} ${REFERENCE_IMAGE} -write null:  null:
+${MAGICK} ${REFERENCE_IMAGE} -write info:  null:
+${MAGICK} ${REFERENCE_IMAGE} -write miff:- null: | ${IDENTIFY} -
+${MAGICK} ${REFERENCE_IMAGE} -write -      null: | ${IDENTIFY} -
+
+# IMv7 "magick" testing
+# -read option
+${MAGICK} -read ${REFERENCE_IMAGE} info:
+# -exit can be used insted of implicit write
+${MAGICK} ${REFERENCE_IMAGE} -write info: -exit
+# null: does not require an image during write
+${MAGICK} -write null: -exit
+# implied write null: without image
+${MAGICK} ${REFERENCE_IMAGE} -write info: +delete null:
+# Write to file decriptor
+${MAGICK} ${REFERENCE_IMAGE} fd:6  6>&1 | ${IDENTIFY} -
+# Read from file decriptor
+exec 5<${REFERENCE_IMAGE}
+${MAGICK} fd:5 info:
+exec 5<&-
+# pipelined magick script
+echo "-read ${REFERENCE_IMAGE} -write info:" | ${MAGICK} -script -
+# pipelined magick script, input image pre-read
+echo "-write info:" | ${MAGICK} ${REFERENCE_IMAGE} -script -
+# pipelined script from file descriptor, read image from stdin
+echo "-read pnm:- -write info:" |\
+   ${MAGICK} -script fd:5 5<&0 <${REFERENCE_IMAGE}
+:
diff --git a/tests/validate-stream.tap b/tests/validate-stream.tap
new file mode 100755 (executable)
index 0000000..38eb511
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
+#  dedicated to making software imaging solutions freely available.
+#
+#  You may not use this file except in compliance with the License.  You may
+#  obtain a copy of the License at
+#
+#    http://www.imagemagick.org/script/license.php
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  Test for 'validate' utility.
+#
+
+set -e # Exit on any error
+. ${srcdir}/tests/common.shi
+echo "1..1"
+
+${VALIDATE} -validate stream && echo "ok" || echo "not ok"
+: