diff --git a/src/tests/servers/app/bitmap_drawing/main.cpp b/src/tests/servers/app/bitmap_drawing/main.cpp index a38ecf6c43..778847e35d 100644 --- a/src/tests/servers/app/bitmap_drawing/main.cpp +++ b/src/tests/servers/app/bitmap_drawing/main.cpp @@ -101,9 +101,9 @@ TestView::TestView(BRect frame, const char* name, // fBitmap(new BBitmap(BRect(0, 0, kBitmapWidth - 1, kBitmapHeight -1), 0, kBitmapFormat)), // fBitmap(new BBitmap(BRect(0, 0, 32 - 1, 8 - 1), 0, B_CMAP8)), // fBitmap(new BBitmap(BRect(0, 0, 32 - 1, 8 - 1), 0, B_GRAY8)), - fBitmap(new BBitmap(BRect(0, 0, 99, 99), B_RGB32, true)), -// fBitmap(new BBitmap(BRect(0, 0, 99, 99), B_CMAP8, true)), -// fBitmap(new BBitmap(BRect(0, 0, 31, 31), B_GRAY8, true)), + fBitmap(new BBitmap(BRect(0, 0, 199, 99), B_RGB32, true)), +// fBitmap(new BBitmap(BRect(0, 0, 199, 99), B_CMAP8, true)), +// fBitmap(new BBitmap(BRect(0, 0, 199, 99), B_GRAY8, true)), fOffscreenView(new BView(fBitmap->Bounds(), "Offscreen view", B_FOLLOW_ALL, B_WILL_DRAW | B_SUBPIXEL_PRECISE)), fTicker(NULL), @@ -385,15 +385,20 @@ TestView::_FillBitmap(point* polygon) fOffscreenView->FillRect(fOffscreenView->Bounds(), B_SOLID_LOW); fOffscreenView->SetDrawingMode(B_OP_OVER); + fOffscreenView->SetPenSize(4); + fOffscreenView->SetLineMode(B_BUTT_CAP, B_ROUND_JOIN); - fOffscreenView->StrokeLine(BPoint(polygon[0].x, polygon[0].y), - BPoint(polygon[1].x, polygon[1].y)); - fOffscreenView->StrokeLine(BPoint(polygon[1].x, polygon[1].y), - BPoint(polygon[2].x, polygon[2].y)); - fOffscreenView->StrokeLine(BPoint(polygon[2].x, polygon[2].y), - BPoint(polygon[3].x, polygon[3].y)); - fOffscreenView->StrokeLine(BPoint(polygon[3].x, polygon[3].y), - BPoint(polygon[0].x, polygon[0].y)); + BPoint pointList[4]; + pointList[0].x = polygon[0].x; + pointList[0].y = polygon[0].y; + pointList[1].x = polygon[1].x; + pointList[1].y = polygon[1].y; + pointList[2].x = polygon[2].x; + pointList[2].y = polygon[2].y; + pointList[3].x = polygon[3].x; + pointList[3].y = polygon[3].y; + + fOffscreenView->StrokePolygon(pointList, 4); fOffscreenView->Sync(); fBitmap->Unlock(); diff --git a/src/tests/servers/app/bitmap_drawing/run b/src/tests/servers/app/bitmap_drawing/run index ac6a66e7b8..23515ce973 100755 --- a/src/tests/servers/app/bitmap_drawing/run +++ b/src/tests/servers/app/bitmap_drawing/run @@ -1,6 +1,18 @@ #!/bin/sh -../../../../../tests/servers/registrar/run_haiku_registrar || exit -../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server & +../../../../../generated/tests/apps/run_haiku_registrar || exit + +if test -f ../../../../../generated/tests/apps/haiku_app_server; then + ../../../../../generated/tests/apps/haiku_app_server & +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + sleep 1s -../../../../../distro/x86.release.r5/beos/apps/BitmapDrawing + +if test -f ../../../../../generated/tests/apps/BitmapDrawing; then + ../../../../../generated/tests/apps/BitmapDrawing +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + diff --git a/src/tests/servers/app/copy_bits/Jamfile b/src/tests/servers/app/copy_bits/Jamfile index b92d7c1f76..24ecb98266 100644 --- a/src/tests/servers/app/copy_bits/Jamfile +++ b/src/tests/servers/app/copy_bits/Jamfile @@ -10,7 +10,7 @@ SimpleTest CopyBits : main.cpp : be ; -if ( $(TARGET_PLATFORM) = libbe_test ) { - HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CopyBits - : tests!apps ; -} +#if ( $(TARGET_PLATFORM) = libbe_test ) { +# HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CopyBits +# : tests!apps ; +#} diff --git a/src/tests/servers/app/copy_bits/run b/src/tests/servers/app/copy_bits/run index 018f48644a..354b406b21 100755 --- a/src/tests/servers/app/copy_bits/run +++ b/src/tests/servers/app/copy_bits/run @@ -1,6 +1,17 @@ #!/bin/sh -../../../../../tests/servers/registrar/run_haiku_registrar || exit -../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server & +../../../../../generated/tests/apps/run_haiku_registrar || exit + +if test -f ../../../../../generated/tests/apps/haiku_app_server; then + ../../../../../generated/tests/apps/haiku_app_server & +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + sleep 1s -../../../../../tests/servers/app/copy_bits/CopyBits + +if test -f ../../../../../generated/tests/apps/CopyBits; then + ../../../../../generated/tests/apps/CopyBits +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi diff --git a/src/tests/servers/app/playground/ObjectView.cpp b/src/tests/servers/app/playground/ObjectView.cpp index b43d152687..7952c2c55d 100644 --- a/src/tests/servers/app/playground/ObjectView.cpp +++ b/src/tests/servers/app/playground/ObjectView.cpp @@ -16,7 +16,7 @@ // constructor ObjectView::ObjectView(BRect frame, const char* name, uint32 resizeFlags, uint32 flags) - : BView(frame, name, resizeFlags, flags | B_FRAME_EVENTS), + : BView(frame, name, resizeFlags, flags), fState(NULL), fObjectType(OBJECT_LINE), fStateList(20), @@ -31,11 +31,12 @@ ObjectView::ObjectView(BRect frame, const char* name, SetLowColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_1_TINT)); - BFont font; - GetFont(&font); - font.SetSize(20.0); - font.SetRotation(6.0); - SetFont(&font, B_FONT_ROTATION | B_FONT_SIZE); +// BFont font; +// GetFont(&font); +// font.SetFamilyAndStyle("Bitstream Vera Serif", "Roman"); +// font.SetSize(20.0); +//// font.SetRotation(6.0); +// SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_ROTATION | B_FONT_SIZE); } // AttachedToWindow @@ -70,35 +71,18 @@ ObjectView::Draw(BRect updateRect) SetHighColor(255, 0, 0, 128); - const char* message = "Click and drag"; + const char* message = "Click and drag to draw an object"; float width = StringWidth(message); + BPoint p(r.Width() / 2.0 - width / 2.0, r.Height() / 2.0); +Sync(); +bigtime_t now = system_time(); DrawString(message, p); - message = "to draw an "; - width = StringWidth("to draw an object"); - p.x = r.Width() / 2.0 - width / 2.0; - p.y += 25; - - DrawString(message, p); - -// SetOrigin(BPoint(50.0, 50.0)); -// SetScale(0.5); - - DrawChar('o'); - DrawChar('b'); - DrawChar('j'); - DrawChar('e'); - DrawChar('c'); - DrawChar('t'); - DrawChar('!'); - - -// SetHighColor(0, 0, 0); -// StrokeLine(BPoint(-50, -50), BPoint(0.0, 0.0)); - +Sync(); +printf("Drawing Text: %lld\n", system_time() - now); for (int32 i = 0; State* state = (State*)fStateList.ItemAt(i); i++) state->Draw(this); @@ -236,7 +220,10 @@ ObjectView::AddObject(State* state) { if (state) { fStateList.AddItem((void*)state); - Window()->PostMessage(MSG_OBJECT_COUNT_CHANGED); + + BMessage message(MSG_OBJECT_ADDED); + message.AddPointer("object", state); + Window()->PostMessage(&message); SetState(state); } diff --git a/src/tests/servers/app/playground/ObjectView.h b/src/tests/servers/app/playground/ObjectView.h index 91308e9601..cb30e54607 100644 --- a/src/tests/servers/app/playground/ObjectView.h +++ b/src/tests/servers/app/playground/ObjectView.h @@ -9,7 +9,8 @@ class State; enum { - MSG_OBJECT_COUNT_CHANGED = 'obcc', + MSG_OBJECT_COUNT_CHANGED = 'obcc', + MSG_OBJECT_ADDED = 'obad', }; class ObjectView : public BView { diff --git a/src/tests/servers/app/playground/ObjectWindow.cpp b/src/tests/servers/app/playground/ObjectWindow.cpp index 96f7c5f25f..53c7c8481f 100644 --- a/src/tests/servers/app/playground/ObjectWindow.cpp +++ b/src/tests/servers/app/playground/ObjectWindow.cpp @@ -43,14 +43,34 @@ enum { MSG_REDO = 'redo', MSG_CLEAR = 'clir', + + MSG_OBJECT_SELECTED = 'obsl', }; +// ObjectItem +class ObjectItem : public BStringItem { + public: + ObjectItem(const char* name, State* object) + : BStringItem(name), + fObject(object) + { + } + + State* Object() const + { return fObject; } + + private: + State* fObject; +}; + +// #pragma mark - + // constructor ObjectWindow::ObjectWindow(BRect frame, const char* name) - : BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, - B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) -// : BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, +// : BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, // B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) + : BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, + B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) // : BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, // B_ASYNCHRONOUS_CONTROLS) // : BWindow(frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, @@ -281,6 +301,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) b.bottom = fDrawingModeMF->Frame().top - 5.0; fObjectLV = new BListView(b, "object list", B_MULTIPLE_SELECTION_LIST); + fObjectLV->SetSelectionMessage(new BMessage(MSG_OBJECT_SELECTED)); // wrap a scroll view around the list view scrollView = new BScrollView("list scroller", fObjectLV, @@ -343,21 +364,23 @@ ObjectWindow::MessageReceived(BMessage* message) fObjectView->SetStateColor(_GetColor()); _UpdateColorControls(); break; - case MSG_OBJECT_COUNT_CHANGED: { - int32 count = fObjectView->CountObjects(); -//printf("MSG_OBJECT_COUNT_CHANGED: %ld\n", count); - fClearB->SetEnabled(count > 0); - int32 listCount = fObjectLV->CountItems(); - int32 diff = count - listCount; - if (diff >= 0) { - for (int32 i = 0; i < diff; i++) - fObjectLV->AddItem(new BStringItem("Object")); - } else { - for (int32 i = listCount - 1; i >= count; i--) - delete fObjectLV->RemoveItem(i); + case MSG_OBJECT_ADDED: { + State* object; + if (message->FindPointer("object", (void**)&object) >= B_OK) { + fObjectLV->AddItem(new ObjectItem("Object", object)); } - break; + // fall through } + case MSG_OBJECT_COUNT_CHANGED: + fClearB->SetEnabled(fObjectView->CountObjects() > 0); + break; + case MSG_OBJECT_SELECTED: +printf("MSG_OBJECT_SELECTED\n"); + if (ObjectItem* item = (ObjectItem*)fObjectLV->ItemAt(fObjectLV->CurrentSelection(0))) { + fObjectView->SetState(item->Object()); + } else + fObjectView->SetState(NULL); + break; case MSG_NEW_OBJECT: fObjectView->SetState(NULL); break; diff --git a/src/tests/servers/app/playground/run b/src/tests/servers/app/playground/run index 042ff6fd0f..d63314085a 100755 --- a/src/tests/servers/app/playground/run +++ b/src/tests/servers/app/playground/run @@ -1,6 +1,6 @@ #!/bin/sh -../../../../../tests/servers/registrar/run_haiku_registrar || exit +../../../../../generated/tests/apps/run_haiku_registrar || exit if test -f ../../../../../generated/tests/apps/haiku_app_server; then ../../../../../generated/tests/apps/haiku_app_server & diff --git a/src/tests/servers/app/regularapps/Jamfile b/src/tests/servers/app/regularapps/Jamfile index 6a24561df3..7c63b427d4 100644 --- a/src/tests/servers/app/regularapps/Jamfile +++ b/src/tests/servers/app/regularapps/Jamfile @@ -19,5 +19,7 @@ SimpleTest TestApp_Clock : : Clock.rdef ; +HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : TestApp_Clock + : tests!apps ; } # if $(TARGET_PLATFORM) = libbe_test diff --git a/src/tests/servers/app/resize_limits/run b/src/tests/servers/app/resize_limits/run index e4a8087807..6f948478a7 100755 --- a/src/tests/servers/app/resize_limits/run +++ b/src/tests/servers/app/resize_limits/run @@ -1,6 +1,17 @@ #!/bin/sh -../../../../../tests/servers/registrar/run_haiku_registrar || exit -../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server & +../../../../../generated/tests/apps/run_haiku_registrar || exit + +if test -f ../../../../../generated/tests/apps/haiku_app_server; then + ../../../../../generated/tests/apps/haiku_app_server & +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + sleep 1s -../../../../../distro/x86.release.r5/beos/apps/ResizeLimits + +if test -f ../../../../../generated/tests/apps/ResizeLimits; then + ../../../../../generated/tests/apps/ResizeLimits +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi diff --git a/src/tests/servers/app/scrolling/Jamfile b/src/tests/servers/app/scrolling/Jamfile index 0e924d6a5f..07a36f887d 100644 --- a/src/tests/servers/app/scrolling/Jamfile +++ b/src/tests/servers/app/scrolling/Jamfile @@ -10,3 +10,8 @@ SimpleTest Scrolling : main.cpp : be ; +#if ( $(TARGET_PLATFORM) = libbe_test ) { +# HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Scrolling +# : tests!apps ; +#} + diff --git a/src/tests/servers/app/scrolling/main.cpp b/src/tests/servers/app/scrolling/main.cpp index 737a9c8dfc..e583db9767 100644 --- a/src/tests/servers/app/scrolling/main.cpp +++ b/src/tests/servers/app/scrolling/main.cpp @@ -55,21 +55,22 @@ void TestView::Draw(BRect updateRect) { // ellipses -// TODO: this should be unnecessary -SetPenSize(1.0); - SetHighColor(200, 90, 0, 255); + SetHighColor(200, 90, 0, 100); StrokeEllipse(BPoint(80.0, 50.0), 70.0, 40.0); + SetDrawingMode(B_OP_ALPHA); + SetPenSize(2.0); - SetHighColor(20, 40, 180, 255); + SetHighColor(20, 40, 180, 150); StrokeEllipse(BPoint(230.0, 90.0), 14.0, 60.0); SetPenSize(5.0); - SetHighColor(60, 20, 110, 255); + SetHighColor(60, 20, 110, 100); StrokeEllipse(BPoint(100.0, 180.0), 35.0, 25.0); // text SetHighColor(0, 0, 0, 255); + SetDrawingMode(B_OP_OVER); const char* message = "Click and drag to scroll this view!"; DrawString(message, BPoint(0.0, 30.0)); } @@ -80,6 +81,7 @@ TestView::MouseDown(BPoint where) { fTracking = true; fLastMousePos = where; + SetMouseEventMask(B_POINTER_EVENTS); } // MouseUp @@ -95,7 +97,6 @@ TestView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) { if (fTracking) { -printf("TestView::MouseMoved(%.1f, %.1f)\n", where.x, where.y); BPoint offset = fLastMousePos - where; ScrollBy(offset.x, offset.y); fLastMousePos = where + offset; diff --git a/src/tests/servers/app/scrolling/run b/src/tests/servers/app/scrolling/run index 7273c0c940..d97d466af2 100755 --- a/src/tests/servers/app/scrolling/run +++ b/src/tests/servers/app/scrolling/run @@ -1,6 +1,18 @@ #!/bin/sh -../../../../../tests/servers/registrar/run_haiku_registrar || exit -../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server & +../../../../../generated/tests/apps/run_haiku_registrar || exit + +if test -f ../../../../../generated/tests/apps/haiku_app_server; then + ../../../../../generated/tests/apps/haiku_app_server & +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + sleep 1s -../../../../../tests/servers/app/scrolling/Scrolling + +if test -f ../../../../../generated/tests/apps/Scrolling; then + ../../../../../generated/tests/apps/Scrolling +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + diff --git a/src/tests/servers/app/textview/Jamfile b/src/tests/servers/app/textview/Jamfile index fc67359168..f892485b46 100644 --- a/src/tests/servers/app/textview/Jamfile +++ b/src/tests/servers/app/textview/Jamfile @@ -10,3 +10,7 @@ SimpleTest TextView : main.cpp : be ; +#if ( $(TARGET_PLATFORM) = libbe_test ) { +# HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : TextView +# : tests!apps ; +#} diff --git a/src/tests/servers/app/textview/run b/src/tests/servers/app/textview/run index 7677b7a2c6..f7c97f46eb 100755 --- a/src/tests/servers/app/textview/run +++ b/src/tests/servers/app/textview/run @@ -1,6 +1,18 @@ #!/bin/sh -../../../../../tests/servers/registrar/run_haiku_registrar || exit -../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server & +../../../../../generated/tests/apps/run_haiku_registrar || exit + +if test -f ../../../../../generated/tests/apps/haiku_app_server; then + ../../../../../generated/tests/apps/haiku_app_server & +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi + sleep 1s -../../../../../tests/servers/app/windows/Window + +if test -f ../../../../../generated/tests/apps/TextView; then + ../../../../../generated/tests/apps/TextView +else + echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first." +fi +