From 5f6a39cabead38d0129049791f6410fdd670b8e2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 23 Jul 2014 16:22:51 +0200 Subject: [PATCH] Add testcase from #2946. --- src/tests/servers/app/gradients/main.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/tests/servers/app/gradients/main.cpp b/src/tests/servers/app/gradients/main.cpp index 7f7d6ab5e9..ebc8a58952 100644 --- a/src/tests/servers/app/gradients/main.cpp +++ b/src/tests/servers/app/gradients/main.cpp @@ -67,6 +67,29 @@ public: }; +// Test for https://dev.haiku-os.org/ticket/2946 +// Gradients with an alpha channel are not drawn properly +class AlphaGradientTest : public Test { +public: + AlphaGradientTest() + : + Test("Alpha gradient") + { + } + + virtual void Draw(BView* view, BRect updateRect) + { + BPoint center(50, 50); + float radius = 50.0; + BGradientRadial g(center, radius); + g.AddColor((rgb_color){ 0, 0, 0, 255 }, 0.0); + g.AddColor((rgb_color){ 0, 0, 0, 0 }, 255.0); + view->SetDrawingMode(B_OP_ALPHA); + view->FillEllipse(center, radius, radius, g); + } +}; + + // #pragma mark - @@ -78,6 +101,7 @@ main(int argc, char** argv) TestWindow* window = new TestWindow("Gradient tests"); window->AddTest(new RadialGradientTest()); + window->AddTest(new AlphaGradientTest()); window->SetToTest(0); window->Show();