diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index a1e68d9497..84d73e0201 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -20,8 +20,8 @@ UseFreeTypeHeaders ; local defines = [ FDefines TEST_MODE=1 ] ; # USE_DIRECT_WINDOW_TEST_MODE=1 -SubDirCcFlags $(defines) ; # -fcheck-memory-usage -finstrument-functions -D_NO_INLINE_ASM ; -SubDirC++Flags $(defines) ; #-fcheck-memory-usage -finstrument-functions -D_NO_INLINE_ASM ; +SubDirCcFlags $(defines) -fcheck-memory-usage -D_NO_INLINE_ASM ; +SubDirC++Flags $(defines) -fcheck-memory-usage -D_NO_INLINE_ASM ; SEARCH_SOURCE += $(appServerDir) [ FDirName $(appServerDir) drawing ] ; @@ -144,6 +144,7 @@ SubInclude HAIKU_TOP src tests servers app avoid_focus ; SubInclude HAIKU_TOP src tests servers app bitmap_drawing ; SubInclude HAIKU_TOP src tests servers app code_to_name ; SubInclude HAIKU_TOP src tests servers app copy_bits ; +SubInclude HAIKU_TOP src tests servers app cursor_test ; SubInclude HAIKU_TOP src tests servers app desktop_window ; SubInclude HAIKU_TOP src tests servers app event_mask ; SubInclude HAIKU_TOP src tests servers app look_and_feel ; diff --git a/src/tests/servers/app/cursor_test/CursorTest.cpp b/src/tests/servers/app/cursor_test/CursorTest.cpp new file mode 100644 index 0000000000..7b32c24c79 --- /dev/null +++ b/src/tests/servers/app/cursor_test/CursorTest.cpp @@ -0,0 +1,145 @@ +/* + * Copyright 2006, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + */ + + +#include +#include +#include +#include +#include + +#include +#include +#include + + +class View : public BView { + public: + View(BRect rect); + virtual ~View(); + + virtual void AttachedToWindow(); + virtual void Pulse(); +}; + + +const uint8 kCursorData[68] = { + 16, 1, 8, 8, + + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + + 0xff, 0xff, 0x80, 0x01, 0x80, 0x01, 0x8f, 0xf1, + 0x88, 0x11, 0x88, 0x11, 0x88, 0x11, 0x89, 0x91, + 0x89, 0x91, 0x88, 0x11, 0x88, 0x11, 0x88, 0x11, + 0x8f, 0xf1, 0x80, 0x01, 0x80, 0x01, 0xff, 0xff, +}; + +bool gHide = false; + + +View::View(BRect rect) + : BView(rect, "desktop view", B_FOLLOW_ALL, B_WILL_DRAW) +{ + SetViewColor(0, 150, 0); +} + + +View::~View() +{ +} + + +void +View::AttachedToWindow() +{ + BCursor cursor(kCursorData); + SetViewCursor(&cursor); +} + + +// #pragma mark - + + +class Window : public BWindow { + public: + Window(); + virtual ~Window(); + + virtual bool QuitRequested(); +}; + + +Window::Window() + : BWindow(BRect(100, 100, 400, 400), "Cursor-Test", + B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) +{ + BView *view = new View(Bounds().InsetByCopy(30, 30)); + 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-cursor_test") +{ +} + + +void +Application::ReadyToRun() +{ + Window *window = new Window(); + window->Show(); + + if (gHide) + HideCursor(); + else + SetCursor(B_I_BEAM_CURSOR); +} + + +// #pragma mark - + + +int +main(int argc, char **argv) +{ + if (argc > 1 && !strcmp(argv[1], "hide")) + gHide = true; + + Application app; + + app.Run(); + return 0; +} diff --git a/src/tests/servers/app/cursor_test/Jamfile b/src/tests/servers/app/cursor_test/Jamfile new file mode 100644 index 0000000000..bbc70f791f --- /dev/null +++ b/src/tests/servers/app/cursor_test/Jamfile @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src tests servers app cursor_test ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +Application CursorTest : + CursorTest.cpp + : be +; + +if $(TARGET_PLATFORM) = libbe_test { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CursorTest + : tests!apps ; +} +