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
This commit is contained in:
Axel Dörfler
2005-11-04 09:46:44 +00:00
parent 57a9b06645
commit e0d7d87fc4
3 changed files with 170 additions and 3 deletions
+4 -3
View File
@@ -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 ;
+22
View File
@@ -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 ;
}
@@ -0,0 +1,144 @@
/*
* Copyright 2005, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, [email protected]
*/
#include <Application.h>
#include <Window.h>
#include <View.h>
#include <stdio.h>
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;
}