Add a test for radial gradients.
* This shows that the radius is ignored and all gradients are drwan with a radius of 100.
This commit is contained in:
@@ -235,6 +235,7 @@ SubInclude HAIKU_TOP src tests servers app event_mask ;
|
|||||||
SubInclude HAIKU_TOP src tests servers app find_view ;
|
SubInclude HAIKU_TOP src tests servers app find_view ;
|
||||||
SubInclude HAIKU_TOP src tests servers app following ;
|
SubInclude HAIKU_TOP src tests servers app following ;
|
||||||
SubInclude HAIKU_TOP src tests servers app font_spacing ;
|
SubInclude HAIKU_TOP src tests servers app font_spacing ;
|
||||||
|
SubInclude HAIKU_TOP src tests servers app gradients ;
|
||||||
SubInclude HAIKU_TOP src tests servers app hide_and_show ;
|
SubInclude HAIKU_TOP src tests servers app hide_and_show ;
|
||||||
SubInclude HAIKU_TOP src tests servers app idle_test ;
|
SubInclude HAIKU_TOP src tests servers app idle_test ;
|
||||||
SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ;
|
SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
resource app_signature "application/x-vnd.Haiku-Gradients";
|
||||||
|
|
||||||
|
resource app_flags B_SINGLE_LAUNCH;
|
||||||
|
|
||||||
|
resource app_version {
|
||||||
|
major = 1,
|
||||||
|
middle = 0,
|
||||||
|
minor = 0,
|
||||||
|
|
||||||
|
variety = B_APPV_ALPHA,
|
||||||
|
internal = 1,
|
||||||
|
|
||||||
|
short_info = "Gradients",
|
||||||
|
long_info = "Gradients ©2014 Haiku"
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
SubDir HAIKU_TOP src tests servers app gradients ;
|
||||||
|
|
||||||
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
|
UseHeaders [ FDirName os app ] ;
|
||||||
|
UseHeaders [ FDirName os interface ] ;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src tests servers app harness ] ;
|
||||||
|
|
||||||
|
SimpleTest Gradients :
|
||||||
|
harness.cpp
|
||||||
|
main.cpp
|
||||||
|
: be $(TARGET_LIBSUPC++)
|
||||||
|
: Gradients.rdef
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( $(TARGET_PLATFORM) = libbe_test ) {
|
||||||
|
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Gradients
|
||||||
|
: tests!apps ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Adrien Destugues <[email protected]>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <GradientRadial.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
|
#include <List.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <PopUpMenu.h>
|
||||||
|
#include <Roster.h>
|
||||||
|
#include <ScrollView.h>
|
||||||
|
#include <String.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
#include <View.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
|
#include "harness.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const char* kAppSignature = "application/x-vnd.Haiku-Gradients";
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - Test1
|
||||||
|
|
||||||
|
|
||||||
|
class RadialGradientTest : public Test {
|
||||||
|
public:
|
||||||
|
RadialGradientTest()
|
||||||
|
:
|
||||||
|
Test("Radial Gradient")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Draw(BView* view, BRect updateRect)
|
||||||
|
{
|
||||||
|
// Draws two radial gradients with the same stops and different radiis,
|
||||||
|
// and their enclosing circles. The gradients and circles should have
|
||||||
|
// the same size.
|
||||||
|
BGradientRadial g1(100, 100, 50);
|
||||||
|
BGradientRadial g2(300, 100, 100);
|
||||||
|
|
||||||
|
g1.AddColor(make_color(0,0,0,255), 0);
|
||||||
|
g1.AddColor(make_color(255,255,255,255), 255);
|
||||||
|
|
||||||
|
g2.AddColor(make_color(0,0,0,255), 0);
|
||||||
|
g2.AddColor(make_color(255,255,255,255), 255);
|
||||||
|
|
||||||
|
BRect r1(0, 0, 200, 200);
|
||||||
|
BRect r2(200, 0, 400, 200);
|
||||||
|
view->FillRect(r1, g1);
|
||||||
|
view->FillRect(r2, g2);
|
||||||
|
|
||||||
|
r1.InsetBy(50, 50);
|
||||||
|
view->StrokeEllipse(r1);
|
||||||
|
view->StrokeEllipse(r2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
BApplication app(kAppSignature);
|
||||||
|
|
||||||
|
TestWindow* window = new TestWindow("Gradient tests");
|
||||||
|
|
||||||
|
window->AddTest(new RadialGradientTest());
|
||||||
|
|
||||||
|
window->SetToTest(0);
|
||||||
|
window->Show();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user