From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- meson/test cases/frameworks/9 wxwidgets/mainwin.h | 23 +++++++++ .../test cases/frameworks/9 wxwidgets/meson.build | 19 ++++++++ meson/test cases/frameworks/9 wxwidgets/wxprog.cpp | 56 ++++++++++++++++++++++ meson/test cases/frameworks/9 wxwidgets/wxstc.cpp | 6 +++ 4 files changed, 104 insertions(+) create mode 100644 meson/test cases/frameworks/9 wxwidgets/mainwin.h create mode 100644 meson/test cases/frameworks/9 wxwidgets/meson.build create mode 100644 meson/test cases/frameworks/9 wxwidgets/wxprog.cpp create mode 100644 meson/test cases/frameworks/9 wxwidgets/wxstc.cpp (limited to 'meson/test cases/frameworks/9 wxwidgets') diff --git a/meson/test cases/frameworks/9 wxwidgets/mainwin.h b/meson/test cases/frameworks/9 wxwidgets/mainwin.h new file mode 100644 index 000000000..b5ca18de3 --- /dev/null +++ b/meson/test cases/frameworks/9 wxwidgets/mainwin.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +class MyApp: public wxApp +{ +public: + virtual bool OnInit(); +}; +class MyFrame: public wxFrame +{ +public: + MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); +private: + void OnHello(wxCommandEvent& event); + void OnExit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + wxDECLARE_EVENT_TABLE(); +}; + +enum { + ID_Hello = 1 +}; diff --git a/meson/test cases/frameworks/9 wxwidgets/meson.build b/meson/test cases/frameworks/9 wxwidgets/meson.build new file mode 100644 index 000000000..0c7ecaa11 --- /dev/null +++ b/meson/test cases/frameworks/9 wxwidgets/meson.build @@ -0,0 +1,19 @@ +project('wxwidgets test', 'cpp', default_options : ['cpp_std=c++11']) + +wxd = dependency('wxwidgets', version : '>=5', required : false) +wxd = dependency('wxwidgets', version : '>=3.0.0', required : false) + +if wxd.found() + wp = executable('wxprog', 'wxprog.cpp', dependencies : wxd) + + test('wxtest', wp) + + # WxWidgets framework is available, we can use required here + wx_stc = dependency('wxwidgets', version : '>=3.0.0', modules : ['std', 'stc']) + stc_exe = executable('wxstc', 'wxstc.cpp', dependencies : wx_stc) + test('wxstctest', stc_exe) + + # Check we can apply a version constraint + dependency('wxwidgets', version: '>=@0@'.format(wxd.version())) + +endif diff --git a/meson/test cases/frameworks/9 wxwidgets/wxprog.cpp b/meson/test cases/frameworks/9 wxwidgets/wxprog.cpp new file mode 100644 index 000000000..2be5512ee --- /dev/null +++ b/meson/test cases/frameworks/9 wxwidgets/wxprog.cpp @@ -0,0 +1,56 @@ +#include"mainwin.h" + +wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) +EVT_MENU(ID_Hello, MyFrame::OnHello) +EVT_MENU(wxID_EXIT, MyFrame::OnExit) +EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) +wxEND_EVENT_TABLE() + +bool MyApp::OnInit() { + MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340)); + frame->Show( true ); + return true; +} + +MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) + : wxFrame(NULL, wxID_ANY, title, pos, size) { + wxMenu *menuFile = new wxMenu; + menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", + "Help string shown in status bar for this menu item"); + menuFile->AppendSeparator(); + menuFile->Append(wxID_EXIT); + wxMenu *menuHelp = new wxMenu; + menuHelp->Append(wxID_ABOUT); + wxMenuBar *menuBar = new wxMenuBar; + menuBar->Append(menuFile, "&File"); + menuBar->Append(menuHelp, "&Help"); + SetMenuBar(menuBar); + CreateStatusBar(); + SetStatusText("This is status." ); +} + +void MyFrame::OnExit(wxCommandEvent& event) { + Close( true ); +} + +void MyFrame::OnAbout(wxCommandEvent& event) { + //wxMessageBox("Some text", wxOK | wxICON_INFORMATION); +} + +void MyFrame::OnHello(wxCommandEvent& event) { + wxLogMessage("Some more text."); +} + +#if 0 +wxIMPLEMENT_APP(MyApp); +#else +// Don't open a window because this is an unit test and needs to +// run headless. +int main(int, char **) { + wxString name("Some app"); + wxPoint p(0, 0); + wxSize s(100, 100); + return 0; +} + +#endif diff --git a/meson/test cases/frameworks/9 wxwidgets/wxstc.cpp b/meson/test cases/frameworks/9 wxwidgets/wxstc.cpp new file mode 100644 index 000000000..c0c704350 --- /dev/null +++ b/meson/test cases/frameworks/9 wxwidgets/wxstc.cpp @@ -0,0 +1,6 @@ +#include + +int main(void) { + wxStyledTextCtrl *canvas = new wxStyledTextCtrl(); + delete canvas; +} -- cgit 1.2.3-korg