소스 검색

Added new tests

- comparison (automatic conversion) and comparison with Var-parameter in function
- pixmap test
- max2D, animImage-test (graphical)
Ronny Otto 11 년 전
부모
커밋
52a2eda328

+ 27 - 0
tests/framework/language/comparison_01.bmx

@@ -0,0 +1,27 @@
+'test checks if comparison is done properly
+SuperStrict
+Framework Brl.Standardio
+
+local myVar:int = 1
+if myVar > 1 then print "myVar 1 > 1"
+
+Function CompareParam:int(myvar:int)
+	return myVar>1
+End Function
+
+Function CompareParamVar:int(myvar:int var)
+	return myVar>1
+End Function
+
+
+print "intcasted comparison: "+int(myVar>2)
+
+'fails currently
+print "automatic comparison: "+(myVar>2)
+
+If CompareParam(1) then print "function param failed"
+If CompareParamVar(myvar) then print "function param var failed"
+
+'would segfault in bcc-ng
+'vanilla bcc: Compile Error: Expression for 'Var' parameter must be a variable
+'If CompareParamVar(1) then print "function param var failed"

+ 2 - 0
tests/framework/language/comparison_01.res

@@ -0,0 +1,2 @@
+intcasted comparison: 0
+automatic comparison: 0

+ 44 - 0
tests/framework/mod/brl/max2d/max2d_01.bmx

@@ -0,0 +1,44 @@
+Rem
+	This test checks:
+	- and if loading as animimage works too
+End Rem
+SuperStrict
+Framework BRL.StandardIO
+Import Brl.Pixmap
+Import Brl.GLMax2D
+
+Graphics 640,480,0
+
+'create a pixmap
+local pix:TPixmap = CreatePixmap(64,64, PF_RGBA8888)
+local res:int = TRUE
+'blackout
+pix.ClearPixels(0)
+
+For local x:int = 0 until pix.width
+	For local y:int = 0 until pix.height
+		pix.WritePixel(x,y, RGBA_Color(255, 3*x,4*y, 2*(x+y)) )
+	Next
+Next
+
+local animImage:TImage = LoadAnimImage(pix,32,32,0,4)
+
+
+Cls
+DrawPixmap(pix, 50,50)
+DrawImage(animImage, 150, 50, 0)
+DrawImage(animImage, 200, 50, 1)
+DrawImage(animImage, 150,100, 2)
+DrawImage(animImage, 200,100, 3)
+Flip 0
+Delay(250)
+
+print "success: "+res
+
+
+
+
+
+Function RGBA_Color:Int(alpha:int,r:int,g:int,b:int)
+	Return (Int(alpha * $1000000) + Int(r * $10000) + Int(g * $100) + Int(b))
+EndFunction

+ 1 - 0
tests/framework/mod/brl/max2d/max2d_01.res

@@ -0,0 +1 @@
+success: 1

+ 29 - 0
tests/framework/mod/brl/pixmap/pixmap_01.bmx

@@ -0,0 +1,29 @@
+Rem
+	This test checks:
+	- creation and modification of pixmaps work
+End Rem
+SuperStrict
+Framework BRL.StandardIO
+Import Brl.Pixmap
+
+local pix:TPixmap = CreatePixmap(50,50, PF_RGBA8888)
+local res:int = TRUE
+'blackout
+pix.ClearPixels(0)
+
+For local x:int = 0 until pix.width
+	For local y:int = 0 until pix.height
+		pix.WritePixel(x,y, y*2)
+	Next
+Next
+
+For local x:int = 0 until pix.width
+	For local y:int = 0 until pix.height
+		if y*2 <> pix.ReadPixel(x,y)
+			res = FALSE
+			exit
+		endif
+	Next
+Next
+
+print "success: "+res

+ 1 - 0
tests/framework/mod/brl/pixmap/pixmap_01.res

@@ -0,0 +1 @@
+success: 1