diff --git a/src/tests/kits/interface/Jamfile b/src/tests/kits/interface/Jamfile index 78b3ab017e..8f6aa46985 100644 --- a/src/tests/kits/interface/Jamfile +++ b/src/tests/kits/interface/Jamfile @@ -123,6 +123,11 @@ SimpleTest MenuBeginningTest : ; +Application MenuTriggerTest : + MenuTriggerTest.cpp + : be +; + SEARCH on [ FGristFiles ScrollView.cpp CheckBox.cpp ChannelSlider.cpp ChannelControl.cpp Slider.cpp Control.cpp ] = [ FDirName $(HAIKU_TOP) src kits interface ] ; diff --git a/src/tests/kits/interface/MenuTriggerTest.cpp b/src/tests/kits/interface/MenuTriggerTest.cpp new file mode 100644 index 0000000000..547852f4ab --- /dev/null +++ b/src/tests/kits/interface/MenuTriggerTest.cpp @@ -0,0 +1,105 @@ +/* + * Copyright 2007, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + */ + + +#include +#include +#include +#include +#include + +#include + + +class Window : public BWindow { + public: + Window(); + virtual ~Window(); + + virtual bool QuitRequested(); +}; + + +Window::Window() + : BWindow(BRect(100, 100, 400, 400), "Menu Trigger Test", + B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) +{ + BMenuBar *bar = new BMenuBar(BRect(0, 0, 10, 10), "menuBar"); + AddChild(bar); + + BMenu *menu = new BMenu("File"); + menu->AddItem(new BMenuItem("Bart", NULL)); + menu->AddItem(new BMenuItem("bart", NULL)); + menu->AddItem(new BMenuItem("bart", NULL)); + menu->AddItem(new BMenuItem("Bart", NULL)); + menu->AddItem(new BMenuItem("BART", NULL)); + menu->AddItem(new BMenuItem("bärt", NULL)); + menu->AddItem(new BMenuItem("bärst", NULL)); + menu->AddSeparatorItem(); + menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED))); + bar->AddItem(menu); + + menu = new BMenu("Edit"); + menu->AddItem(new BMenuItem("1 a", NULL)); + menu->AddItem(new BMenuItem("2 a", NULL)); + menu->AddItem(new BMenuItem("3 a", NULL)); + menu->AddItem(new BMenuItem("3 a", NULL)); + menu->AddItem(new BMenuItem("3 aöa", NULL)); + bar->AddItem(menu); + +} + +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; +}