mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Add scripts to test the CLI features
I'm going to move my internals CLI tests to this repo in the near future. This is a first version to try the new --ignore-empty --save-as feature.
This commit is contained in:
		
							parent
							
								
									4d7f3036d8
								
							
						
					
					
						commit
						91e64cd436
					
				|  | @ -0,0 +1,7 @@ | |||
| #! /bin/bash | ||||
| # Copyright (C) 2018 Igara Studio S.A. | ||||
| 
 | ||||
| if ! $ASEPRITE --help | grep "\\-\\-help" > /dev/null ; then | ||||
|     echo "FAILED: --help doesn't include usage information" | ||||
|     exit 1 | ||||
| fi | ||||
|  | @ -0,0 +1,10 @@ | |||
| #! /bin/bash | ||||
| # Copyright (C) 2018 Igara Studio S.A. | ||||
| 
 | ||||
| expect "bg | ||||
| fg" "$ASEPRITE -b --list-layers sprites/1empty3.aseprite" | ||||
| 
 | ||||
| expect "a | ||||
| b | ||||
| c | ||||
| d" "$ASEPRITE -b --list-layers sprites/abcd.aseprite" | ||||
|  | @ -0,0 +1,5 @@ | |||
| #! /bin/bash | ||||
| # Copyright (C) 2018 Igara Studio S.A. | ||||
| 
 | ||||
| expect "a | ||||
| b" "$ASEPRITE -b --list-tags sprites/1empty3.aseprite" | ||||
|  | @ -0,0 +1,23 @@ | |||
| #! /bin/bash | ||||
| # Copyright (C) 2018 Igara Studio S.A. | ||||
| 
 | ||||
| function list_files() { | ||||
|     oldwd=$(pwd) | ||||
|     cd $1 && ls -1 *.* | ||||
|     cd $oldwd | ||||
| } | ||||
| 
 | ||||
| # --save-as | ||||
| 
 | ||||
| d=$t/save-as | ||||
| $ASEPRITE -b sprites/1empty3.aseprite --save-as "$d/image00.png" | ||||
| expect "image00.png | ||||
| image01.png | ||||
| image02.png" "list_files $d" | ||||
| 
 | ||||
| # --ignore-empty --save-as | ||||
| 
 | ||||
| d=$t/save-as-ignore-empty | ||||
| $ASEPRITE -b sprites/1empty3.aseprite --ignore-empty --save-as $d/image00.png | ||||
| expect "image00.png | ||||
| image02.png" "list_files $d" | ||||
|  | @ -0,0 +1,7 @@ | |||
| #! /bin/bash | ||||
| # Copyright (C) 2018 Igara Studio S.A. | ||||
| 
 | ||||
| if ! $ASEPRITE --version | grep "Aseprite 1\\." > /dev/null ; then | ||||
|     echo "FAILED: --version doesn't include 'Aseprite 1.' string" | ||||
|     exit 1 | ||||
| fi | ||||
							
								
								
									
										45
									
								
								run-tests.sh
								
								
								
								
							
							
						
						
									
										45
									
								
								run-tests.sh
								
								
								
								
							|  | @ -1,4 +1,5 @@ | |||
| #! /bin/sh | ||||
| # Copyright (C) 2018 Igara Studio S.A. | ||||
| # Copyright (C) 2018 David Capello | ||||
| 
 | ||||
| if [[ "$ASEPRITE" == "" ]]; then | ||||
|  | @ -12,26 +13,40 @@ function fail() { | |||
|     exit 1 | ||||
| } | ||||
| 
 | ||||
| function expect() { | ||||
|     if [[ $1 != $($2) ]] ; then | ||||
| 	echo "FAILED: $2" | ||||
| 	echo "EXPECTED: $1" | ||||
| 	echo "RESULT: $($2)" | ||||
| 	exit 1 | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| echo ---------------------------------------------------------------------- | ||||
| echo $ASEPRITE --version | ||||
| $ASEPRITE --version | ||||
| 
 | ||||
| echo ---------------------------------------------------------------------- | ||||
| echo Temp dir | ||||
| t=$(mktemp -d) | ||||
| echo $t | ||||
| 
 | ||||
| echo ---------------------------------------------------------------------- | ||||
| echo "Testing console..." | ||||
| $ASEPRITE -b --script scripts/console_assert.lua >tmp 2>tmp_err | ||||
| ! grep -q "this should be in the output" tmp && fail "print() text not found in output" | ||||
| ! grep -q "assertion failed" tmp && fail "assert() text not found in output" | ||||
| grep -q "this should not be in the output" tmp && fail "text that shouldn't be in the output is" | ||||
| $ASEPRITE -b --script scripts/console_assert.lua >$t/tmp 2>$t/tmp_err | ||||
| ! grep -q "this should be in the output" $t/tmp && fail "print() text not found in output" | ||||
| ! grep -q "assertion failed" $t/tmp && fail "assert() text not found in output" | ||||
| grep -q "this should not be in the output" $t/tmp && fail "text that shouldn't be in the output is" | ||||
| 
 | ||||
| if [[ "$(uname)" =~ "MINGW32" ]] || [[ "$(uname)" =~ "MSYS_NT-10.0" ]] ; then | ||||
|     echo Ignore console tests on Windows | ||||
| else | ||||
|     $ASEPRITE -b --script scripts/console_print.lua >tmp 2>tmp_err | ||||
|     cat >tmp_expected <<EOF | ||||
|     $ASEPRITE -b --script scripts/console_print.lua >$t/tmp 2>$t/tmp_err | ||||
|     cat >$t/tmp_expected <<EOF | ||||
| hello world | ||||
| 1	2	3 | ||||
| EOF | ||||
|     ! diff -u tmp tmp_expected && fail | ||||
|     ! diff -u $t/tmp $t/tmp_expected && fail | ||||
| fi | ||||
| 
 | ||||
| echo ---------------------------------------------------------------------- | ||||
|  | @ -40,16 +55,24 @@ echo "Testing scripts..." | |||
| result=0 | ||||
| for script in scripts/*.lua ; do | ||||
|     [[ $script =~ console ]] && continue | ||||
| 
 | ||||
|     echo "Running $script" | ||||
|     if ! $ASEPRITE -b --script $script >tmp 2>tmp_err ; then | ||||
|     if ! $ASEPRITE -b --script $script >$t/tmp 2>$t/tmp_err ; then | ||||
|         echo FAILED | ||||
|         echo STDOUT && cat tmp | ||||
|         echo STDERR && cat tmp_err | ||||
|         echo STDOUT && cat $t/tmp | ||||
|         echo STDERR && cat $t/tmp_err | ||||
|         result=1 | ||||
|     fi | ||||
| done | ||||
| 
 | ||||
| echo ---------------------------------------------------------------------- | ||||
| echo "Testing CLI..." | ||||
| 
 | ||||
| result=0 | ||||
| for script in cli/*.sh ; do | ||||
|     echo "Running $script" | ||||
|     source $script | ||||
| done | ||||
| 
 | ||||
| echo ---------------------------------------------------------------------- | ||||
| echo Done | ||||
| echo ---------------------------------------------------------------------- | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,4 @@ | |||
| # Files | ||||
| 
 | ||||
| * `abcd.aseprite`: Indexed, 32x32, four layers ("a", "b", "c", "d") | ||||
| * `1empty3.aseprite`: RGB, 32x32, two layers ("fg", "bg"), 2nd frame completelly empty, two tags ("a", "b") | ||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue