summaryrefslogtreecommitdiffstats
path: root/imagick-tests.patch
diff options
context:
space:
mode:
Diffstat (limited to 'imagick-tests.patch')
-rw-r--r--imagick-tests.patch94
1 files changed, 0 insertions, 94 deletions
diff --git a/imagick-tests.patch b/imagick-tests.patch
deleted file mode 100644
index 7f6990b..0000000
--- a/imagick-tests.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From 944b67fce68bcb5835999a149f917670555b6fcb Mon Sep 17 00:00:00 2001
-From: Danack <Danack@basereality.com>
-Date: Fri, 9 Feb 2024 13:59:39 +0000
-Subject: [PATCH] Improve test so that is passes.
-
-The underlying maths for some statistics changed: https://github.com/ImageMagick/ImageMagick/issues/6924 so the tests need to pass on both before and after maths.
----
- bisect/bisect_analyze.sh | 61 +++++++++++++++++++++++++
- tests/316_Imagick_getImageKurtosis.phpt | 12 ++++-
- tests/functions.inc | 40 +++++++++++++++-
- 3 files changed, 110 insertions(+), 3 deletions(-)
- create mode 100644 bisect/bisect_analyze.sh
-
-diff --git a/tests/316_Imagick_getImageKurtosis.phpt b/tests/316_Imagick_getImageKurtosis.phpt
-index 2618924a..61370b57 100644
---- a/tests/316_Imagick_getImageKurtosis.phpt
-+++ b/tests/316_Imagick_getImageKurtosis.phpt
-@@ -14,8 +14,16 @@ function getImageKurtosis() {
- $imagick = new \Imagick(__DIR__ . '/Biter_500.jpg');
- $values = $imagick->getImageKurtosis();
-
-- check_value($values, "kurtosis", -0.9379261035010518);
-- check_value($values, "skewness", 0.4562517200972045);
-+ check_value_posibilities(
-+ $values,
-+ "kurtosis",
-+ [-0.9379261035010518, -0.70925995674921]
-+ );
-+ check_value_posibilities(
-+ $values,
-+ "skewness",
-+ [0.4562517200972045, 0.56839010636614]
-+ );
- }
-
- getImageKurtosis() ;
-diff --git a/tests/functions.inc b/tests/functions.inc
-index bbd60ac0..11012864 100644
---- a/tests/functions.inc
-+++ b/tests/functions.inc
-@@ -111,7 +111,10 @@ function setFontForImagickDraw(\ImagickDraw $imagickDraw)
- $imagickDraw->setFont($font);
- }
-
--
-+/**
-+ * Checks that a named value exists in an array and it matches
-+ * an expected value.
-+ */
- function check_value(array $values, $name, $expected_value)
- {
- if (array_key_exists($name, $values) !== true) {
-@@ -136,6 +139,41 @@ function check_value(array $values, $name, $expected_value)
- }
-
-
-+/**
-+ * Checks that a named value exists in an array and it matches
-+ * one of a number of expected values.
-+ * This function exists because the expected values for Kurtosis can
-+ * change when the underlying maths changes: https://github.com/ImageMagick/ImageMagick/issues/6924
-+ */
-+function check_value_posibilities(array $values, $name, array $expected_values)
-+{
-+ if (array_key_exists($name, $values) !== true) {
-+
-+ $message = "Expected key '$name' not set. Array contains:\n";
-+ $message .= var_export($values, true);
-+
-+ throw new \Exception($message);
-+ }
-+
-+
-+ $value = $values[$name];
-+
-+ $epsilon = 0.01;
-+
-+ foreach ($expected_values as $expected_value) {
-+ if (($value > $expected_value - $epsilon) && ($value < $expected_value + $epsilon)) {
-+ echo "Value for '$name' is $value which is close enough to expected $expected_value\n";
-+ return;
-+ }
-+ }
-+
-+ $expected_string = implode(", ", $expected_values);
-+
-+ $message = "Value for $name doesn't match expected possibilities. Expected one of: $expected_string, actual: $value";
-+ throw new \Exception($message);
-+}
-+
-+
- function check_value_with_epsilon(array $values, $name, $expected_value, $epsilon)
- {
- if (array_key_exists($name, $values) !== true) {