From e0d7d87fc43e8c5f88dfaa71a806eaa984d25f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 4 Nov 2005 09:46:44 +0000 Subject: [PATCH] Removed "dano" as compatible platform - the app_server test environment test run there. Added a small test application for view states. Right now, it only tests scaling - which doesn't seem to work yet at all. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14673 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/app/Jamfile | 7 +- src/tests/servers/app/view_state/Jamfile | 22 +++ .../servers/app/view_state/ViewState.cpp | 144 ++++++++++++++++++ 3 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 src/tests/servers/app/view_state/Jamfile create mode 100644 src/tests/servers/app/view_state/ViewState.cpp diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index 809192c3ec..6d8847104b 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src tests servers app ; -SetSubDirSupportedPlatforms r5 bone dano ; +SetSubDirSupportedPlatforms r5 bone ; UseHeaders [ FStandardOSHeaders ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; @@ -57,6 +57,7 @@ SharedLibrary libhaikuappserver.so : CursorData.cpp CursorSet.cpp Decorator.cpp + DesktopSettings.cpp FontFamily.cpp IPoint.cpp LayerData.cpp @@ -84,7 +85,7 @@ Server haiku_app_server : # Misc. Sources DebugInfoManager.cpp SubWindowList.cpp - PicturePlayer.cpp + #PicturePlayer.cpp PNGDump.cpp RAMLinkMsgReader.cpp MessageLooper.cpp @@ -96,7 +97,6 @@ Server haiku_app_server : AppServer.cpp Desktop.cpp - DesktopSettings.cpp ServerApp.cpp ServerWindow.cpp @@ -149,3 +149,4 @@ SubInclude HAIKU_TOP src tests servers app resize_limits ; SubInclude HAIKU_TOP src tests servers app scrolling ; SubInclude HAIKU_TOP src tests servers app textview ; SubInclude HAIKU_TOP src tests servers app regularapps ; +SubInclude HAIKU_TOP src tests servers app view_state ; diff --git a/src/tests/servers/app/view_state/Jamfile b/src/tests/servers/app/view_state/Jamfile new file mode 100644 index 0000000000..aee5da9547 --- /dev/null +++ b/src/tests/servers/app/view_state/Jamfile @@ -0,0 +1,22 @@ +SubDir HAIKU_TOP src tests servers app view_state ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +Application ViewState : + ViewState.cpp +; + +if ( $(TARGET_PLATFORM) = haiku ) { + # for running natively under R5 or Haiku: + LinkAgainst ViewState : be ; +} else { + # for running in the Haiku app_server under R5: + LinkAgainst ViewState : libopenbeos.so ; + + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : ViewState + : tests!apps ; +} + diff --git a/src/tests/servers/app/view_state/ViewState.cpp b/src/tests/servers/app/view_state/ViewState.cpp new file mode 100644 index 0000000000..502aba388a --- /dev/null +++ b/src/tests/servers/app/view_state/ViewState.cpp @@ -0,0 +1,144 @@ +/* + * Copyright 2005, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + */ + + +#include +#include +#include + +#include + + +class View : public BView { + public: + View(BRect rect); + virtual ~View(); + + virtual void Draw(BRect updateRect); +}; + + +View::View(BRect rect) + : BView(rect, "view state", B_FOLLOW_ALL, B_WILL_DRAW) +{ +} + + +View::~View() +{ +} + + +void +View::Draw(BRect updateRect) +{ + SetHighColor(100, 100, 100); + StrokeRect(Bounds()); + + // TODO: for now, we only test scaling functionality + + SetHighColor(42, 42, 242); + StrokeRect(BRect(5, 5, 10, 10)); +#ifdef __HAIKU__ + printf("scale 1: %g\n", Scale()); +#endif + + SetScale(2.0); + StrokeRect(BRect(5, 5, 10, 10)); +#ifdef __HAIKU__ + printf("scale 2: %g\n", Scale()); +#endif + + SetHighColor(42, 242, 42); + PushState(); + StrokeRect(BRect(6, 6, 11, 11)); +#ifdef __HAIKU__ + printf("scale 3: %g\n", Scale()); +#endif + + SetHighColor(242, 42, 42); + SetScale(2.0); + StrokeRect(BRect(5, 5, 10, 10)); +#ifdef __HAIKU__ + printf("scale 4: %g\n", Scale()); +#endif + + PopState(); + SetScale(1.0); +} + + +// #pragma mark - + + +class Window : public BWindow { + public: + Window(); + virtual ~Window(); + + virtual bool QuitRequested(); +}; + + +Window::Window() + : BWindow(BRect(100, 100, 400, 400), "ViewState-Test", + B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) +{ + BView *view = new View(BRect(10, 10, 290, 290)); + 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(void); +}; + + +Application::Application() + : BApplication("application/x-vnd.haiku-view_state") +{ +} + + +void +Application::ReadyToRun(void) +{ + Window *window = new Window(); + window->Show(); +} + + +// #pragma mark - + + +int +main(int argc, char **argv) +{ + Application app;// app; + + app.Run(); + return 0; +}