add more test code

This commit is contained in:
vcaesar 2021-12-01 11:43:32 -04:00
parent c466829ded
commit 8d6e60ce67

View File

@ -14,6 +14,7 @@
package robotgo
import (
"fmt"
"testing"
"github.com/vcaesar/tt"
@ -157,6 +158,20 @@ func TestBitmap(t *testing.T) {
e := SaveBitmap(bit, "robot_test.png")
tt.Empty(t, e)
bit0 := CaptureScreen(10, 10, 20, 20)
x, y := FindBitmap(bit0)
fmt.Println("Find bitmap: ", x, y)
arr := FindAllBitmap(bit0)
fmt.Println("Find all bitmap:", arr)
tt.Equal(t, 1, len(arr))
c1 := CHex(0xAADCDC)
x, y = FindColor(c1)
fmt.Println("Find color: ", x, y)
arr = FindAllColor(c1)
fmt.Println("Find all color: ", arr)
img := ToImage(bit)
err := SavePng(img, "robot_img.png")
tt.Nil(t, err)