From 02f49ce1ec2888b4aef43362eca0c1f5767e60cb Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 27 May 2007 16:18:44 +0000 Subject: [PATCH] * Beginnings of a BBox test. * The test to be run can be chosen via command line argument ("box" or "button" ATM). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21253 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../layout/widget_layout_test/BoxTest.cpp | 61 +++++++++++++++++++ .../layout/widget_layout_test/BoxTest.h | 29 +++++++++ .../layout/widget_layout_test/Jamfile | 1 + .../widget_layout_test/WidgetLayoutTest.cpp | 22 ++++++- 4 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp create mode 100644 src/tests/kits/interface/layout/widget_layout_test/BoxTest.h diff --git a/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp b/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp new file mode 100644 index 0000000000..e8b2d416a2 --- /dev/null +++ b/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp @@ -0,0 +1,61 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "BoxTest.h" + +#include + +#include +#include + + +// constructor +BoxTest::BoxTest() + : Test("Box", NULL), + fBox(new BBox(BRect(0, 0, 9, 9), "test box", B_FOLLOW_NONE)) +// TODO: Layout-friendly constructor +{ + SetView(fBox); +} + + +// destructor +BoxTest::~BoxTest() +{ +} + + +// ActivateTest +void +BoxTest::ActivateTest(View* controls) +{ +/* GroupView* group = new GroupView(B_VERTICAL); + group->SetFrame(controls->Bounds()); + group->SetSpacing(0, 8); + controls->AddChild(group); + + // long button text + fLongTextCheckBox = new LabeledCheckBox("Long Button Text", + new BMessage(MSG_CHANGE_BUTTON_TEXT), this); + group->AddChild(fLongTextCheckBox); + + // big font + fBigFontCheckBox = new LabeledCheckBox("Big Button Font", + new BMessage(MSG_CHANGE_BUTTON_FONT), this); + group->AddChild(fBigFontCheckBox); + + group->AddChild(new Glue()); + + _SetButtonText(false); + _SetButtonFont(false); +*/ +} + + +// DectivateTest +void +BoxTest::DectivateTest() +{ +} diff --git a/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h b/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h new file mode 100644 index 0000000000..2184d2c7a2 --- /dev/null +++ b/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h @@ -0,0 +1,29 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_BOX_TEST_H +#define WIDGET_LAYOUT_TEST_BOX_TEST_H + + +#include "Test.h" + + +class BBox; +class View; + + +class BoxTest : public Test { +public: + BoxTest(); + virtual ~BoxTest(); + + virtual void ActivateTest(View* controls); + virtual void DectivateTest(); + +private: + BBox* fBox; +}; + + +#endif // WIDGET_LAYOUT_TEST_BOX_TEST_H diff --git a/src/tests/kits/interface/layout/widget_layout_test/Jamfile b/src/tests/kits/interface/layout/widget_layout_test/Jamfile index e5d5bbe59c..c148949bab 100644 --- a/src/tests/kits/interface/layout/widget_layout_test/Jamfile +++ b/src/tests/kits/interface/layout/widget_layout_test/Jamfile @@ -5,6 +5,7 @@ SetSubDirSupportedPlatforms haiku libbe_test ; SimpleTest WidgetLayoutTest : WidgetLayoutTest.cpp + BoxTest.cpp ButtonTest.cpp CheckBox.cpp GroupView.cpp diff --git a/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp b/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp index a0523dc79a..c7b8598e2a 100644 --- a/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp +++ b/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp @@ -8,6 +8,7 @@ #include #include +#include "BoxTest.h" #include "ButtonTest.h" #include "CheckBox.h" #include "GroupView.h" @@ -56,6 +57,7 @@ public: // container for the test's controls fTestControlsView = new View(BRect(410, 10, 690, 400)); + fTestControlsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fViewContainer->View::AddChild(fTestControlsView); // wrapper view @@ -255,12 +257,28 @@ private: int -main() +main(int argc, const char* const* argv) { + // get test name + const char* testName = "button"; + if (argc >= 2) + testName = argv[1]; + + // create app BApplication app("application/x-vnd.haiku.widget-layout-test"); - Test* test = new ButtonTest; + // create test + Test* test; + if (strcmp(testName, "box") == 0) { + test = new BoxTest; + } else if (strcmp(testName, "button") == 0) { + test = new ButtonTest; + } else { + fprintf(stderr, "Error: Invalid test name: \"%s\"\n", testName); + exit(1); + } + // show test window BWindow* window = new TestWindow(test); window->Show();