@ -420,98 +420,6 @@ func TestSPI_Draw_DstEmpty(t *testing.T) {
}
}
}
}
var offsetDrawWant = [ ] byte {
0x00 , 0x00 , 0x00 , 0x00 ,
0xE1 , 0x89 , 0x79 , 0x6B ,
0xE1 , 0x9A , 0x88 , 0x75 ,
0xE1 , 0xAD , 0x98 , 0x82 ,
0xE1 , 0xC2 , 0xAB , 0x92 ,
0xE1 , 0xDA , 0xC0 , 0xA4 ,
0xE1 , 0xF5 , 0xD9 , 0xB9 ,
0xE2 , 0x89 , 0x7A , 0x69 ,
0xE2 , 0x9A , 0x8A , 0x76 ,
0xE2 , 0xAC , 0x9B , 0x86 ,
0xE2 , 0xC0 , 0xAE , 0x98 ,
0xE2 , 0xD5 , 0xC3 , 0xAC ,
0xE2 , 0xED , 0xDA , 0xC2 ,
0xE4 , 0x83 , 0x7A , 0x6E ,
0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 ,
0xFF ,
}
var offsetDrawTests = [ ] struct {
name string
img image . Image
point image . Point
offset image . Rectangle
want [ ] byte
opts Opts
} {
{
name : "Offset Draw NRGBA" ,
img : func ( ) image . Image {
im := image . NewNRGBA ( image . Rect ( 0 , 0 , 16 , 4 ) )
for x := 0 ; x < 16 ; x ++ {
for y := 0 ; y < 4 ; y ++ {
i := ( y * 16 + x ) * 3
im . Set ( x , y , color . RGBA { R : uint8 ( i + 1 ) , G : uint8 ( i + 2 ) , B : uint8 ( i + 3 ) , A : 0xFF } )
}
}
return im
} ( ) ,
point : image . Point { X : 3 , Y : 2 } ,
offset : image . Rect ( 0 , 0 , 16 , 1 ) ,
want : offsetDrawWant ,
opts : Opts {
NumPixels : 15 ,
Channels : 3 ,
Freq : 2500 * physic . KiloHertz ,
} ,
} ,
{
name : "Both Offset Draw NRGBA" ,
img : func ( ) image . Image {
im := image . NewNRGBA ( image . Rect ( 0 , 0 , 16 , 4 ) )
for x := 0 ; x < 16 ; x ++ {
for y := 0 ; y < 4 ; y ++ {
i := ( y * 16 + x ) * 3
im . Set ( x , y , color . RGBA { R : uint8 ( i + 1 ) , G : uint8 ( i + 2 ) , B : uint8 ( i + 3 ) , A : 0xFF } )
}
}
return im
} ( ) ,
point : image . Point { X : 3 , Y : 2 } ,
offset : image . Rect ( 2 , 0 , 16 , 1 ) ,
want : [ ] byte {
0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 ,
0xE1 , 0x89 , 0x79 , 0x6B ,
0xE1 , 0x9A , 0x88 , 0x75 ,
0xE1 , 0xAD , 0x98 , 0x82 ,
0xE1 , 0xC2 , 0xAB , 0x92 ,
0xE1 , 0xDA , 0xC0 , 0xA4 ,
0xE1 , 0xF5 , 0xD9 , 0xB9 ,
0xE2 , 0x89 , 0x7A , 0x69 ,
0xE2 , 0x9A , 0x8A , 0x76 ,
0xE2 , 0xAC , 0x9B , 0x86 ,
0xE2 , 0xC0 , 0xAE , 0x98 ,
0xE2 , 0xD5 , 0xC3 , 0xAC ,
0xE2 , 0xED , 0xDA , 0xC2 ,
0xE4 , 0x83 , 0x7A , 0x6E ,
0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 ,
0xFF , 0xFF ,
} ,
opts : Opts {
NumPixels : 17 ,
Channels : 3 ,
Freq : 2500 * physic . KiloHertz ,
} ,
} ,
}
func TestSPI_Halt ( t * testing . T ) {
func TestSPI_Halt ( t * testing . T ) {
s := spitest . Playback {
s := spitest . Playback {
Playback : conntest . Playback {
Playback : conntest . Playback {
@ -737,15 +645,3 @@ type limitLow struct {
func ( c * limitLow ) MaxTxSize ( ) int {
func ( c * limitLow ) MaxTxSize ( ) int {
return 1
return 1
}
}
func equalUint16 ( a , b [ ] uint16 ) bool {
if len ( a ) != len ( b ) {
return false
}
for i := range a {
if a [ i ] != b [ i ] {
return false
}
}
return true
}