[ascii] test loading surfaces
This commit is contained in:
184
projects/asciilib2/test/assets/laptop.srf
Normal file
184
projects/asciilib2/test/assets/laptop.srf
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
COLORS
|
||||||
|
! 128 128 255
|
||||||
|
" 255 255 255
|
||||||
|
# 98 49 0
|
||||||
|
$ 159 80 0
|
||||||
|
% 41 41 41
|
||||||
|
& 128 128 128
|
||||||
|
' 106 106 106
|
||||||
|
( 0 0 0
|
||||||
|
INFO CODES
|
||||||
|
! .
|
||||||
|
" POINT_screen
|
||||||
|
SIZE
|
||||||
|
68 33
|
||||||
|
CHARACTERS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test text on laptop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BACKGROUND COLORS
|
||||||
|
!!!!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%!!!!
|
||||||
|
!!!!%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%!!!!
|
||||||
|
!!!!%&''''''''''''''''''''''''''''''''''''''''''''''''''''''''&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&'(((((((((((((((((((((((((((((((((((((((((((((((((((((('&%!!!!
|
||||||
|
!!!!%&''''''''''''''''''''''''''''''''''''''''''''''''''''''''&%!!!!
|
||||||
|
!!!!%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%!!!!
|
||||||
|
!!!!%''''''''''''''''''''''''''''''''''''''''''''''''''''''''''%!!!!
|
||||||
|
!!!%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%!!!
|
||||||
|
!!!%&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''&&%!!!
|
||||||
|
!!%&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&%!!
|
||||||
|
!!%&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&&%!!
|
||||||
|
!%&&'&&&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&%!
|
||||||
|
!%&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&&%!
|
||||||
|
%&&'&&&&&'&&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&'&&&&&'&&%
|
||||||
|
%&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&&%
|
||||||
|
CHARACTER COLORS
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
OPACITY
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00001111111111111111111111111111111111111111111111111111111111110000
|
||||||
|
00011111111111111111111111111111111111111111111111111111111111111000
|
||||||
|
00011111111111111111111111111111111111111111111111111111111111111000
|
||||||
|
00111111111111111111111111111111111111111111111111111111111111111100
|
||||||
|
00111111111111111111111111111111111111111111111111111111111111111100
|
||||||
|
01111111111111111111111111111111111111111111111111111111111111111110
|
||||||
|
01111111111111111111111111111111111111111111111111111111111111111110
|
||||||
|
11111111111111111111111111111111111111111111111111111111111111111111
|
||||||
|
11111111111111111111111111111111111111111111111111111111111111111111
|
||||||
|
SPECIAL INFO
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
42
projects/asciilib2/test/src/cases/LoadSurfaceTestCase.hx
Normal file
42
projects/asciilib2/test/src/cases/LoadSurfaceTestCase.hx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package cases;
|
||||||
|
|
||||||
|
import utest.Test;
|
||||||
|
import utest.Assert;
|
||||||
|
import asciilib.GameLogic;
|
||||||
|
import asciilib.Game;
|
||||||
|
import asciilib.Graphics;
|
||||||
|
import asciilib.Colors;
|
||||||
|
import asciilib.Assets;
|
||||||
|
import asciilib.Surface;
|
||||||
|
|
||||||
|
class LoadSurfaceGameLogic implements GameLogic {
|
||||||
|
public function new() {}
|
||||||
|
|
||||||
|
public function initialize(assets:Assets) {
|
||||||
|
assets.loadSurface("laptop", "assets/laptop.srf");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(game:Game, deltaSeconds:Float):Void {}
|
||||||
|
|
||||||
|
public function draw(graphics:Void->Graphics, assets:Assets):Void {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSurfaceTestCase extends Test {
|
||||||
|
function testLoadSurface() {
|
||||||
|
var game = Main.newGame(new LoadSurfaceGameLogic());
|
||||||
|
var laptop = game.assets.getSurface("laptop");
|
||||||
|
|
||||||
|
var cornerColor = laptop.getBackgroundColor(0, 0);
|
||||||
|
Assert.equals(128, cornerColor.r);
|
||||||
|
Assert.equals(128, cornerColor.g);
|
||||||
|
Assert.equals(255, cornerColor.b);
|
||||||
|
Assert.isFalse(laptop.isCellOpaque(0, 0));
|
||||||
|
var topColor = laptop.getBackgroundColor(6, 0);
|
||||||
|
Assert.equals(41, topColor.r);
|
||||||
|
Assert.isTrue(laptop.isCellOpaque(6, 0));
|
||||||
|
Assert.equals(".", laptop.getSpecialInfo(0, 0));
|
||||||
|
Assert.equals("POINT_screen", laptop.getSpecialInfo(8, 4));
|
||||||
|
Assert.equals("t", laptop.getLetter(17, 6).char);
|
||||||
|
Assert.equals(" ", laptop.getLetter(18, 6).char);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user