MCPcopy
hub / github.com/anthonynsimon/bild / TestDifference

Function TestDifference

blend/blend_test.go:559–648  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

557}
558
559func TestDifference(t *testing.T) {
560 cases := []struct {
561 value0 image.Image
562 value1 image.Image
563 expected *image.RGBA
564 }{
565 {
566 value0: &image.RGBA{
567 Rect: image.Rect(0, 0, 2, 2),
568 Stride: 8,
569 Pix: []uint8{
570 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
571 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
572 },
573 },
574 value1: &image.RGBA{
575 Rect: image.Rect(0, 0, 2, 2),
576 Stride: 8,
577 Pix: []uint8{
578 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
579 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
580 },
581 },
582 expected: &image.RGBA{
583 Rect: image.Rect(0, 0, 2, 2),
584 Stride: 8,
585 Pix: []uint8{
586 0x3f, 0x3f, 0x3f, 0xff, 0x3f, 0x3f, 0x3f, 0xff, 0x3f, 0x3f, 0x3f, 0xff, 0x3f, 0x3f, 0x3f, 0xff,
587 },
588 },
589 },
590 {
591 value0: &image.RGBA{
592 Rect: image.Rect(0, 0, 2, 2),
593 Stride: 8,
594 Pix: []uint8{
595 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
596 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
597 },
598 },
599 value1: &image.RGBA{
600 Rect: image.Rect(0, 0, 2, 2),
601 Stride: 8,
602 Pix: []uint8{
603 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
604 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
605 },
606 },
607 expected: &image.RGBA{
608 Rect: image.Rect(0, 0, 2, 2),
609 Stride: 8,
610 Pix: []uint8{
611 0x1b, 0x1b, 0x1b, 0x40, 0x1b, 0x1b, 0x1b, 0x40, 0x1b, 0x1b, 0x1b, 0x40, 0x1b, 0x1b, 0x1b, 0x40,
612 },
613 },
614 },
615 {
616 value0: &image.RGBA{

Callers

nothing calls this directly

Calls 2

RGBAImageEqualFunction · 0.92
DifferenceFunction · 0.85

Tested by

no test coverage detected