diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9f3fabd..dcb384c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- choiceL: [--disable-silent-rules, --enable-silent-rules --enable-debugtime]
+ choiceL: [--disable-silent-rules, --enable-silent-rules, --enable-debugtime]
steps:
- uses: actions/checkout@v2
- name: Create configure
@@ -22,6 +22,13 @@ jobs:
- name: Test make strip
if: matrix.choiceL == '--disable-silent-rules'
run: make strip
+ - name: Do a make check
+ if: matrix.choiceL == '--enable-silent-rules'
+ run: |
+ cd tests
+ ./test1.sh
+ cd ..
+ run: make check
- name: Test user-level install/uninstall
if: matrix.choiceL == '--disable-silent-rules'
run: |
@@ -50,7 +57,7 @@ jobs:
run:
shell: msys2 {0}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
diff --git a/Makefile.am b/Makefile.am
index 17f80a6..01db2d8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
# Makefile.am - Top level automakefile for fix-ca
-SUBDIRS = . po
+SUBDIRS = . po tests
# The braces around ACLOCAL_FLAGS below instead of parentheses are intentional!
# Otherwise autoreconf misparses the line.
diff --git a/configure.ac b/configure.ac
index 4e99683..ecba307 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ AC_PREREQ([2.68])
#
m4_define([fix_ca_name], [gimp-fix-ca])
m4_define([fix_ca_major_version], [4])
-m4_define([fix_ca_minor_version], [0])
+m4_define([fix_ca_minor_version], [1])
m4_define([fix_ca_version],[fix_ca_major_version.fix_ca_minor_version])
m4_define([fix_ca_package_name], [gimp-fix-ca])
m4_define([fix_ca_package_home], [https://github.com/JoesCat/gimp-fix-ca])
@@ -51,8 +51,10 @@ AC_PROG_CC
AC_PROG_SED
AC_PROG_LN_S
AC_PROG_MKDIR_P
+AC_PATH_PROG([CHMOD],[chmod],[:])
AC_PATH_PROG([STRIP],[strip],[:])
AC_PATH_PROG([GIMPTOOL],[gimptool-2.0],[:])
+AC_PATH_PROG([MD5SUM],[md5sum],[:])
AC_PATH_PROG([MSGFMT],[msgfmt],[:])
AC_PATH_PROG([MSGINIT],[msginit],[:])
AC_PATH_PROG([MSGMERGE],[msgmerge],[:])
@@ -240,6 +242,7 @@ AH_BOTTOM([
AC_CONFIG_FILES([
Makefile
po/Makefile
+tests/Makefile
rpm/gimp-fix-ca.spec
])
AC_OUTPUT
diff --git a/fix-ca.c b/fix-ca.c
index 0b64e17..229ecd8 100644
--- a/fix-ca.c
+++ b/fix-ca.c
@@ -49,7 +49,11 @@
#define N_(x) x
#endif
+#ifdef TEST_FIX_CA
+#define PROCEDURE_NAME "Test-Fix-CA"
+#else
#define PROCEDURE_NAME "Fix-CA"
+#endif
#define DATA_KEY_VALS "fix_ca"
/* Size controls in Fix CA dialog box */
@@ -238,6 +242,8 @@ static void run (const gchar *name, gint nparams,
#endif
textdomain( GETTEXT_PACKAGE );
#endif
+ gegl_init (NULL, NULL);
+
switch (run_mode) {
case GIMP_RUN_NONINTERACTIVE:
fix_ca_params.blue = param[3].data.d_float;
@@ -317,6 +323,8 @@ static void run (const gchar *name, gint nparams,
}
}
+ gegl_exit ();
+
values[0].data.d_status = status;
}
@@ -348,8 +356,6 @@ static int fix_ca (gint32 drawable_ID, FixCaParams *params)
return -1;
}
- //gegl_init (NULL, NULL);
-
/* fetch pixel regions and setup shadow buffer */
srcBuf = gimp_drawable_get_buffer (drawable_ID);
destBuf = gimp_drawable_get_shadow_buffer (drawable_ID);
@@ -377,8 +383,6 @@ static int fix_ca (gint32 drawable_ID, FixCaParams *params)
gimp_drawable_merge_shadow (drawable_ID, TRUE);
gimp_drawable_update (drawable_ID, x, y, width, height);
- //gegl_exit ();
-
#ifdef DEBUG_TIME
gettimeofday(&tv2, NULL);
diff --git a/org.gimp.extension.fix-ca.metainfo.xml b/org.gimp.extension.fix-ca.metainfo.xml
index a2b0548..29cfbbc 100644
--- a/org.gimp.extension.fix-ca.metainfo.xml
+++ b/org.gimp.extension.fix-ca.metainfo.xml
@@ -38,7 +38,8 @@
CC0-1.0
GPL-3.0+
-
+
+
diff --git a/rpm/gimp-fix-ca.spec.in b/rpm/gimp-fix-ca.spec.in
index a144512..59d28c8 100644
--- a/rpm/gimp-fix-ca.spec.in
+++ b/rpm/gimp-fix-ca.spec.in
@@ -4,32 +4,31 @@
%define moname gimp20-fix-ca
%define plugindir %{_libdir}/gimp/2.0/plug-ins/fix-ca
-Name: @FIX_CA_PACKAGE_NAME@
+Name: gimp-fix-ca
Version: @FIX_CA_VERSION@
Release: 0
Summary: A Gimp2 plugin for correcting Chromatic Aberration (CA)
License: GPLv3+
Group: Graphics/Editors and Converters
URL: https://github.com/JoesCat/gimp-fix-ca
-Source0: https://github.com/JoesCat/gimp-fix-ca/releases/download/%{version}/%{name}-%{version}.tar.gz
+Source0: https://github.com/JoesCat/gimp-fix-ca/archive/%{version}/gimp-fix-ca-%{version}.tar.gz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: make
+BuildRequires: md5sum
BuildRequires: gettext-devel
BuildRequires: gtk+2-devel
BuildRequires: pkgconfig(gimp-2.0)
Requires: gimp >= 2.10.0
-
%description
A Gimp2 plug-in to correct Chromatic Aberration (CA).
Fix-CA can fix Lateral CA caused due to light travelling through lenses,
and fix Directional CA due to light travelling through dense material
such as glass or water.
-
%prep
%setup -q
@@ -39,13 +38,14 @@ automake --add-missing
%configure
%make_build
+%check
+make check
%install
%make_install INSTALLDIR="%{buildroot}/%{plugindir}" \
LOCALEDIR="%{buildroot}/%{_datadir}/locale"
%find_lang %{moname}
-
%files -f %{moname}.lang
%license COPYING
%{plugindir}/fix-ca
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..ec09580
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,34 @@
+scripttests = test1.sh
+
+AM_CFLAGS = ${CFLAGS} ${CPPFLAGS} ${GIMP_CFLAGS} ${GTK_CFLAGS} ${WCFLAGS} ${FCA_CFLAGS} -I${top_srcdir} -I${top_builddir}
+
+AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} ${GIMP_CFLAGS} -I${includedir}
+
+EXTRA_DIST = test-fix-ca.c test.scm test1.md5
+nodist_bin_SCRIPTS = test1.sh
+
+noinst_PROGRAMS = test-fix-ca
+test_fix_ca_name = test-fix-ca
+test_fix_ca_SOURCES = test-fix-ca.c
+test_fix_ca.$(OBJEXT): fix-ca-config.h
+test_fix_ca_LDADD = ${LIBS} ${GIMP_LIBS} ${GTK_LIBS} ${WSLIB} ${FCA_LIB}
+
+update-tests: $(scripttests)
+
+$(scripttests):
+ echo "#!/bin/sh" > ${builddir}/test1.sh; \
+ echo "rm -f ${builddir}/test1.tga" >> ${builddir}/test1.sh; \
+ echo "${GIMPTOOL} --install-script ${srcdir}/test.scm" >> ${builddir}/test1.sh; \
+ echo "${GIMPTOOL} --install-bin ${builddir}/test-fix-ca" >> ${builddir}/test1.sh; \
+ echo "gimp --verbose --console-messages -b '(test \"${top_srcdir}/img-fix-ca/full-branches.jpg\" \"${builddir}/test1.tga\" 6.0 -2.4 658 1280 1 0.0 0.0 0.0 0.0)' -b '(gimp-quit 0)'" >> ${builddir}/test1.sh; \
+ echo "${GIMPTOOL} --uninstall-bin test-fix-ca" >> ${builddir}/test1.sh; \
+ echo "${GIMPTOOL} --uninstall-script test.scm" >> ${builddir}/test1.sh; \
+ echo "${MD5SUM} -c ${top_srcdir}/tests/test1.md5" >> ${builddir}/test1.sh; \
+ ${CHMOD} +x ${builddir}/test1.sh
+
+TESTS = ${builddir}/test1.sh
+
+clean-local:
+ rm -f ${builddir}/test?.sh ${builddir}/test?.tga
+
+.PHONY: update-tests
diff --git a/tests/test-fix-ca.c b/tests/test-fix-ca.c
new file mode 100644
index 0000000..c3e1a9b
--- /dev/null
+++ b/tests/test-fix-ca.c
@@ -0,0 +1,2 @@
+#define TEST_FIX_CA 1
+#include "../fix-ca.c"
diff --git a/tests/test.scm b/tests/test.scm
new file mode 100644
index 0000000..e068723
--- /dev/null
+++ b/tests/test.scm
@@ -0,0 +1,6 @@
+(define (test filename result bluel redl lensx lensy interpolation bluex redx bluey redy)
+ (define image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
+ (define drawable (car (gimp-image-get-active-layer image)))
+ (Test-Fix-CA RUN-NONINTERACTIVE image drawable bluel redl lensx lensy interpolation bluex redx bluey redy)
+ (gimp-file-save RUN-NONINTERACTIVE image drawable result result)
+ (gimp-image-delete image))
diff --git a/tests/test1.md5 b/tests/test1.md5
new file mode 100644
index 0000000..e33a2d3
--- /dev/null
+++ b/tests/test1.md5
@@ -0,0 +1 @@
+7e59db2f8eeafbc0a37d5fddde45c14c test1.tga