From 5393a051101bd40829fae33abb0011420994b800 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Sat, 6 Mar 2021 16:25:09 +0200 Subject: [PATCH] gpu/internal/rendertest: test depth buffer overlaps Regression test for 44991f355cc9938d02dc500062a20a8a61ac2cfa Signed-off-by: Egon Elbre --- .../rendertest/refs/TestDepthOverlap.png | Bin 0 -> 375 bytes gpu/internal/rendertest/render_test.go | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 gpu/internal/rendertest/refs/TestDepthOverlap.png diff --git a/gpu/internal/rendertest/refs/TestDepthOverlap.png b/gpu/internal/rendertest/refs/TestDepthOverlap.png new file mode 100644 index 0000000000000000000000000000000000000000..6c5d99807533f09e3c365fcd8fba2a135965032a GIT binary patch literal 375 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1SEZ8zRh7^V6^jeaSW-L^X76O=K%u|mV*IG zd(OqXK1t@d8(6U6PTc!lw_^7FzsUS=9YX};2Brko16&QF4B8A~3~T5waJ%ZjM#;So lJopFF5pcijGcf%B-)zdtwC~E?KfnNG@O1TaS?83{1OPHjXA}Sc literal 0 HcmV?d00001 diff --git a/gpu/internal/rendertest/render_test.go b/gpu/internal/rendertest/render_test.go index 9cdb68ec..3e027eb3 100644 --- a/gpu/internal/rendertest/render_test.go +++ b/gpu/internal/rendertest/render_test.go @@ -223,6 +223,22 @@ func TestNegativeOverlaps(t *testing.T) { }) } +func TestDepthOverlap(t *testing.T) { + run(t, func(ops *op.Ops) { + stack := op.Save(ops) + paint.FillShape(ops, red, clip.Rect{Max: image.Pt(128, 64)}.Op()) + stack.Load() + + stack = op.Save(ops) + paint.FillShape(ops, green, clip.Rect{Max: image.Pt(64, 128)}.Op()) + stack.Load() + }, func(r result) { + r.expect(96, 32, colornames.Red) + r.expect(32, 96, colornames.Green) + r.expect(32, 32, colornames.Green) + }) +} + type Gradient struct { From, To color.NRGBA }