Test more things in color
This commit is contained in:
		
							parent
							
								
									6bfa97e6aa
								
							
						
					
					
						commit
						19fcdb4a7d
					
				| @ -1,6 +1,23 @@ | |||||||
| package ucolor | package ucolor | ||||||
| 
 | 
 | ||||||
| import "testing" | import "testing" | ||||||
|  | import "image/color" | ||||||
|  | 
 | ||||||
|  | func TestTransparent (test *testing.T) { | ||||||
|  | 	if Transparent(color.NRGBA { A: 255 }) { | ||||||
|  | 		test.Fatal("false positive") | ||||||
|  | 	} | ||||||
|  | 	if !Transparent(color.NRGBA { A: 0 }) { | ||||||
|  | 		test.Fatal("false negative") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func TestToRGBA (test *testing.T) { | ||||||
|  | 	rgba := ToRGBA(color.NRGBA { R: 123, G: 100, B: 23, A: 230 }) | ||||||
|  | 	if rgba != (color.RGBA { R: 111, G: 90, B: 20, A: 230 }) { | ||||||
|  | 		test.Fatalf("wrong value: %v", rgba) | ||||||
|  | 	} | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| func TestPremultiply (test *testing.T) { | func TestPremultiply (test *testing.T) { | ||||||
| 	r, g, b, a := Premultiply(0xFFFF, 0xFFFF, 0xFFFF, 0x8888) | 	r, g, b, a := Premultiply(0xFFFF, 0xFFFF, 0xFFFF, 0x8888) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user