aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile17
-rw-r--r--README.ru2
-rw-r--r--img-fu21
-rw-r--r--test.scm15
4 files changed, 27 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 8dacd2b..52da294 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ MAIN = plugin-img
GIMPTOOL = gimptool-2.0
GIMP = gimp
+GIMPCONSOLE = gimp-console
CC = cc
LD = cc
CFLAGS = -O2 -Wall -Wextra
@@ -18,13 +19,15 @@ $(OBJ): $(HDR) Makefile
.c.o:
$(CC) `$(GIMPTOOL) --cflags` $(CFLAGS) -c $< -o $@
-.PHONY: test
-test: install
- gimp samples/*.img
+.PHONY: view
+view: install
+ $(GIMP) samples/*.img
-.PHONY: test-fu
-test-fu: install img-fu
- $(GIMP) --no-interface --batch - < img-fu
+.PHONY: test
+test: test.scm install
+ rm -f samples/success
+ $(GIMPCONSOLE) --no-interface --batch - < $<
+ test -f samples/success
.PHONY: install
install: $(MAIN)
@@ -37,4 +40,6 @@ uninstall:
.PHONY: clean
clean:
rm -f *.o *.i *.s $(MAIN)
+ rm -f samples/recoded-*
+ rm -f samples/success
diff --git a/README.ru b/README.ru
index c3dd0ae..f51cfe8 100644
--- a/README.ru
+++ b/README.ru
@@ -26,7 +26,7 @@ F2-как у меня), то файл сохранится в том же фор
размеры всех слоёв должны совпадать с размерами изображения. Если что-то не так плагин
скажет об этом.
-Пример неинтерактивной работы плагина показан в файле img-fu.
+ Пример неинтерактивной работы плагина показан в файле test.scm.
diff --git a/img-fu b/img-fu
deleted file mode 100644
index 17c1b6e..0000000
--- a/img-fu
+++ /dev/null
@@ -1,21 +0,0 @@
-(define (img-recode
- srcfile
- destfile
- fmt
- ckey)
-
-(let*
- (
- (image (car (file-img-load RUN-NONINTERACTIVE srcfile srcfile)))
- (drawable (car (gimp-image-get-active-layer image)))
- )
-
- (file-img-save RUN-NONINTERACTIVE image drawable destfile destfile fmt ckey)
-)
-)
-
-(img-recode "samples/rgb.img" "samples/recoded-rgb565.img" "RGB565" "no")
-(img-recode "samples/rgb.img" "samples/recoded-rgba.img" "RGBA" "0x0F0")
-
-(gimp-quit 0)
-
diff --git a/test.scm b/test.scm
new file mode 100644
index 0000000..113c443
--- /dev/null
+++ b/test.scm
@@ -0,0 +1,15 @@
+(define (img-recode srcfile destfile fmt ckey)
+ (let* ((image (car (file-img-load RUN-NONINTERACTIVE srcfile srcfile)))
+ (drawable (car (gimp-image-get-active-layer image))))
+ (file-img-save RUN-NONINTERACTIVE image drawable destfile destfile fmt ckey)))
+
+(catch (gimp-quit 0)
+ (img-recode "samples/rgb.img" "samples/recoded-rgb-rgb565.img" "RGB565" "no")
+ (img-recode "samples/rgb.img" "samples/recoded-rgb-rgba.img" "RGBA" "0x0F0")
+ (img-recode "samples/rgb565.img" "samples/recoded-rgb565-rgb.img" "RGB" "")
+ (img-recode "samples/rgb565.img" "samples/recoded-rgb565-rgba.img" "RGBA" "(255, 255, 255)")
+ (img-recode "samples/rgba.img" "samples/recoded-rgba-rgb.img" "RGB" "no")
+ (img-recode "samples/rgba.img" "samples/recoded-rgba-rgb565.img" "RGB565" "no"))
+
+(with-output-to-file "samples/success" (lambda () (write "SUCCESS")))
+(gimp-quit 0)