⛏️ index : haiku.git

author Kacper Kasper <kacperkasper@gmail.com> 2025-12-23 21:35:42.0 +01:00:00
committer Kacper Kasper <kacperkasper@gmail.com> 2025-12-23 23:14:55.0 +00:00:00
commit
fca32fdb8b7761e2fda7b6c91bee6fe834849ccb [patch]
tree
017530aeeedb7ab6c94b5c4035a3f68169974490
parent
c8ebd7dde051cf8905c34d20320ab622c1928656
download
fca32fdb8b7761e2fda7b6c91bee6fe834849ccb.tar.gz

Fix test_app_server build

* Add layers_test.

Change-Id: Ibadd70e9be5118e9c9b764600ef515475b86566a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10151
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

Diff

 src/tests/servers/app/Jamfile                    |   2 +-
 src/tests/kits/interface/picture/Jamfile         |   3 +++
 src/tests/servers/app/layers_test/Jamfile        |  17 +++++++++++++++++
 src/tests/servers/app/layers_test/LayersTest.cpp | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)

diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile
index 51a7204..c31133b 100644
--- a/src/tests/servers/app/Jamfile
+++ b/src/tests/servers/app/Jamfile
@@ -123,7 +123,6 @@
SharedLibrary libtestappserver.so :
	Angle.cpp
	ClientMemoryAllocator.cpp
	CursorData.cpp
	CursorManager.cpp
	CursorSet.cpp
	DelayedMessage.cpp
@@ -266,6 +265,7 @@
SubInclude HAIKU_TOP src tests servers app idle_test ;
SubInclude HAIKU_TOP src tests servers app inverse_clipping ;
SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ;
SubInclude HAIKU_TOP src tests servers app layers_test ;
SubInclude HAIKU_TOP src tests servers app lock_focus ;
SubInclude HAIKU_TOP src tests servers app look_and_feel ;
SubInclude HAIKU_TOP src tests servers app menu_crash ;
diff --git a/src/tests/kits/interface/picture/Jamfile b/src/tests/kits/interface/picture/Jamfile
index c4ee401..dbe78a9 100644
--- a/src/tests/kits/interface/picture/Jamfile
+++ b/src/tests/kits/interface/picture/Jamfile
@@ -30,6 +30,9 @@
	[ TargetLibstdc++ ] [ TargetLibsupc++ ]
	;

Includes [ FGristFiles PictureTest.cpp ]
	: [ BuildFeatureAttribute expat : headers ] ;

if $(TARGET_PLATFORM) = libbe_test {
	HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : PictureTest
		: tests!apps ;
diff --git a/src/tests/servers/app/layers_test/Jamfile b/src/tests/servers/app/layers_test/Jamfile
new file mode 100644
index 0000000..0abf898 100644
--- /dev/null
+++ b/src/tests/servers/app/layers_test/Jamfile
@@ -1,0 +1,17 @@
SubDir HAIKU_TOP src tests servers app layers_test ;

AddSubDirSupportedPlatforms libbe_test ;

UseHeaders [ FDirName os app ] ;
UseHeaders [ FDirName os interface ] ;

SimpleTest LayersTest :
	LayersTest.cpp
	: be [ TargetLibstdc++ ] [ TargetLibsupc++ ]
;

if $(TARGET_PLATFORM) = libbe_test {
	HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : LayersTest
		: tests!apps ;
}

diff --git a/src/tests/servers/app/layers_test/LayersTest.cpp b/src/tests/servers/app/layers_test/LayersTest.cpp
new file mode 100644
index 0000000..d384d11 100644
--- /dev/null
+++ b/src/tests/servers/app/layers_test/LayersTest.cpp
@@ -1,0 +1,131 @@
/*
 * Copyright 2016, Haiku Inc.
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *		Kacper Kasper, kacperkasper@gmail.com
 */


#include <Application.h>
#include <GradientRadial.h>
#include <String.h>
#include <View.h>
#include <Window.h>

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>


class View : public BView {
	public:
		View(BRect rect);
		virtual ~View();

		virtual void Draw(BRect);
};

View::View(BRect rect)
	: BView(rect, "gradients", B_FOLLOW_ALL, B_WILL_DRAW)
{
}


View::~View()
{
}


void
View::Draw(BRect)
{
	BGradientRadial g(BPoint(50, 50), 50.0);
	g.AddColor((rgb_color) { 0, 0, 0, 255 }, 255.0);
	g.AddColor((rgb_color) { 255, 255, 255, 0 }, 0.0);
	SetHighColor(0, 0, 0);
	BeginLayer(255);
	// 1, 1
	FillRect(BRect(10, 10, 90, 90));
	// 2, 1
	FillRect(BRect(100, 10, 190, 90), g);
	EndLayer();
	BeginLayer(100);
	// 1, 2
	FillRect(BRect(10, 100, 90, 190));
	// 2, 2
	FillRect(BRect(100, 100, 190, 190), g);
	EndLayer();
}


//	#pragma mark -


class Window : public BWindow {
	public:
		Window();
		virtual ~Window();

		virtual bool QuitRequested();
};


Window::Window()
	: BWindow(BRect(100, 100, 300, 300), "Layers-Test",
			B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	BView *view = new View(Bounds());
	AddChild(view);
}


Window::~Window()
{
}


bool
Window::QuitRequested()
{
	be_app->PostMessage(B_QUIT_REQUESTED);
	return true;
}


//	#pragma mark -


class Application : public BApplication {
	public:
		Application();

		virtual void ReadyToRun();
};


Application::Application()
	: BApplication("application/x-vnd.haiku-layers_test")
{
}


void
Application::ReadyToRun()
{
	Window *window = new Window();
	window->Show();
}


//	#pragma mark -


int
main(int argc, char **argv)
{
	Application app;

	app.Run();
	return 0;
}