From da48b9e45ddbac240c1f68e6303e71610e076ade Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 8 May 2020 08:01:56 +0200 Subject: [PATCH] adding an iOS build to travis (#1847) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixing compilation of tests that cannot build bracket code with the corresponding wxUSE… macros * adding directive for iOS * adding a switch for skipping the run - not the build of tests right now I don’t know yet, how to run the test binary in the iOS simulator, but building it is still a good test in itself * adding skipping of tests * increasing minimum deployment to get proper c++17 support * using --disable-sys-libs, restoring other targets even when the zlib in -isysroot is used, due to deployment on lower iOS versions inflateValidate may not be available and crash. The guards are evaluated using macros from the zlib from the SDK, not from the lowest version supported. --- .travis.yml | 2 +- build/tools/travis-ci.sh | 5 +++++ include/wx/osx/iphone/chkconf.h | 2 ++ tests/archive/archivetest.cpp | 16 ++++++++++++++++ tests/archive/archivetest.h | 4 ++++ tests/controls/auitest.cpp | 4 ++++ tests/controls/bookctrlbasetest.cpp | 4 ++++ tests/controls/dialogtest.cpp | 11 ++++++++--- tests/controls/listviewtest.cpp | 4 ++++ tests/controls/pickerbasetest.cpp | 7 +++++++ tests/controls/pickertest.cpp | 7 +++++++ tests/controls/rearrangelisttest.cpp | 4 ++++ tests/controls/spinctrldbltest.cpp | 4 ++++ tests/controls/windowtest.cpp | 4 ++++ tests/events/propagation.cpp | 7 ++++++- tests/interactive/output.cpp | 2 ++ tests/menu/menu.cpp | 4 ++++ tests/misc/garbage.cpp | 6 ++++-- tests/persistence/dataview.cpp | 4 ++++ tests/sizers/boxsizer.cpp | 2 ++ 20 files changed, 96 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index c9206603d2..5512fed8e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ matrix: name: wxOSX Xcode 11.3 - os: osx osx_image: xcode11.4 - env: wxCONFIGURE_FLAGS="--enable-monolithic --with-cxx=17 --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 --with-osx_iphone --with-macosx-version-min=9.0 --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --enable-stl --with-libtiff=builtin" wxSKIP_GUI=1 wxSKIP_SAMPLES=1 + env: wxCONFIGURE_FLAGS="--enable-monolithic --with-cxx=17 --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 --with-osx_iphone --with-macosx-version-min=10.0 --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --enable-stl --disable-sys-libs" wxSKIP_GUI=1 wxSKIP_TESTING=1 wxSKIP_SAMPLES=1 name: wxOSX iOS Xcode 11.4 - dist: bionic compiler: gcc diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 6f57b046ec..5b00dca6cc 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -73,6 +73,11 @@ case $wxTOOLSET in make -C tests $wxJOBS $wxMAKEFILE_FLAGS echo -en 'travis_fold:end:script.tests\\r' + if [ "$wxSKIP_TESTING" = 1 ]; then + echo 'Skipping running tests' + exit 0 + fi + echo 'Testing...' && echo -en 'travis_fold:start:script.testing\\r' pushd tests && ./test && popd echo -en 'travis_fold:end:script.testing\\r' diff --git a/include/wx/osx/iphone/chkconf.h b/include/wx/osx/iphone/chkconf.h index 9f313759d9..116c5776c8 100644 --- a/include/wx/osx/iphone/chkconf.h +++ b/include/wx/osx/iphone/chkconf.h @@ -213,6 +213,7 @@ #undef wxUSE_FINDREPLDLG #undef wxUSE_TASKBARICON #undef wxUSE_REARRANGECTRL +#undef wxUSE_NATIVE_DATAVIEWCTRL #define wxUSE_LOGWINDOW 0 #define wxUSE_LOG_DIALOG 0 @@ -235,6 +236,7 @@ #define wxUSE_FINDREPLDLG 0 #define wxUSE_TASKBARICON 0 #define wxUSE_REARRANGECTRL 0 +#define wxUSE_NATIVE_DATAVIEWCTRL 0 #if wxUSE_WXHTML_HELP #undef wxUSE_WXHTML_HELP diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index ce12543b3e..a890e56bb5 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -462,7 +462,13 @@ void ArchiveTestCase::runTest() if (m_archiver.empty()) CreateArchive(out); else + { +#ifndef __WXOSX_IPHONE__ CreateArchive(out, m_archiver); +#else + CPPUNIT_FAIL("using external archivers is not supported on iOS"); +#endif + } // check archive could be created CPPUNIT_ASSERT(out.GetLength() > 0); @@ -489,7 +495,13 @@ void ArchiveTestCase::runTest() if (m_unarchiver.empty()) ExtractArchive(in); else + { +#ifndef __WXOSX_IPHONE__ ExtractArchive(in, m_unarchiver); +#else + CPPUNIT_FAIL("using external archivers is not supported on iOS"); +#endif + } // check that all the test entries were found in the archive CPPUNIT_ASSERT(m_testEntries.empty()); @@ -620,6 +632,7 @@ void ArchiveTestCase::CreateArchive(wxOutputStream& out) // Create an archive using an external archive program // +#ifndef __WXOSX_IPHONE__ template void ArchiveTestCase::CreateArchive(wxOutputStream& out, const wxString& archiver) @@ -683,6 +696,7 @@ void ArchiveTestCase::CreateArchive(wxOutputStream& out, out.Write(in); } } +#endif // Do a standard set of modification on an archive, delete an entry, // rename an entry and add an entry @@ -864,6 +878,7 @@ void ArchiveTestCase::ExtractArchive(wxInputStream& in) // Extract an archive using an external unarchive program // +#ifndef __WXOSX_IPHONE__ template void ArchiveTestCase::ExtractArchive(wxInputStream& in, const wxString& unarchiver) @@ -905,6 +920,7 @@ void ArchiveTestCase::ExtractArchive(wxInputStream& in, wxString dir = tmpdir.GetName(); VerifyDir(dir); } +#endif // Verifies the files produced by an external unarchiver are as expected // diff --git a/tests/archive/archivetest.h b/tests/archive/archivetest.h index 88186448d9..25a1db7535 100644 --- a/tests/archive/archivetest.h +++ b/tests/archive/archivetest.h @@ -180,14 +180,18 @@ protected: // 'archive up' the test data void CreateArchive(wxOutputStream& out); +#ifndef __WXOSX_IPHONE__ void CreateArchive(wxOutputStream& out, const wxString& archiver); +#endif // perform various modifications on the archive void ModifyArchive(wxInputStream& in, wxOutputStream& out); // extract the archive and verify its contents void ExtractArchive(wxInputStream& in); +#ifndef __WXOSX_IPHONE__ void ExtractArchive(wxInputStream& in, const wxString& unarchiver); +#endif void VerifyDir(wxString& path, size_t rootlen = 0); // tests for the iterators diff --git a/tests/controls/auitest.cpp b/tests/controls/auitest.cpp index 298db57fcf..5588ef13b8 100644 --- a/tests/controls/auitest.cpp +++ b/tests/controls/auitest.cpp @@ -12,6 +12,8 @@ #include "testprec.h" +#if wxUSE_AUI + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -128,3 +130,5 @@ TEST_CASE( "wxAuiNotebook::DoGetBestSize", "[aui]" ) CHECK( nb->GetBestSize() == wxSize(250, 175 + 3*tabHeight) ); } } + +#endif diff --git a/tests/controls/bookctrlbasetest.cpp b/tests/controls/bookctrlbasetest.cpp index 3aa4cbda63..37cb50520e 100644 --- a/tests/controls/bookctrlbasetest.cpp +++ b/tests/controls/bookctrlbasetest.cpp @@ -8,6 +8,8 @@ #include "testprec.h" +#if wxUSE_BOOKCTRL + #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/panel.h" @@ -163,3 +165,5 @@ void BookCtrlBaseTestCase::Image() CPPUNIT_ASSERT_EQUAL(2, base->GetPageImage(2)); } + +#endif diff --git a/tests/controls/dialogtest.cpp b/tests/controls/dialogtest.cpp index 486e087616..d9bc559e5d 100644 --- a/tests/controls/dialogtest.cpp +++ b/tests/controls/dialogtest.cpp @@ -34,7 +34,9 @@ private: #if !defined (__WXX11__) CPPUNIT_TEST( MessageDialog ); #endif +#if wxUSE_FILEDLG CPPUNIT_TEST( FileDialog ); +#endif CPPUNIT_TEST( CustomDialog ); CPPUNIT_TEST( InitDialog ); CPPUNIT_TEST_SUITE_END(); @@ -60,13 +62,16 @@ void ModalDialogsTestCase::MessageDialog() wxTEST_DIALOG ( rc = wxMessageBox("Should I fail?", "Question", wxYES|wxNO), - wxExpectModal(wxNO), - wxExpectModal(wxGetCwd() + "/test.txt").Optional() + wxExpectModal(wxNO) +#if wxUSE_FILEDLG + ,wxExpectModal(wxGetCwd() + "/test.txt").Optional() +#endif ); CPPUNIT_ASSERT_EQUAL(wxNO, rc); } +#if wxUSE_FILEDLG void ModalDialogsTestCase::FileDialog() { wxFileDialog dlg(NULL); @@ -89,7 +94,7 @@ void ModalDialogsTestCase::FileDialog() wxYield(); #endif } - +#endif class MyDialog : public wxDialog { diff --git a/tests/controls/listviewtest.cpp b/tests/controls/listviewtest.cpp index b4246d9f26..94162d3eab 100644 --- a/tests/controls/listviewtest.cpp +++ b/tests/controls/listviewtest.cpp @@ -8,6 +8,8 @@ #include "testprec.h" +#if wxUSE_LISTCTRL + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -115,3 +117,5 @@ void ListViewTestCase::Focus() CPPUNIT_ASSERT_EQUAL(0, m_list->GetFocusedItem()); } + +#endif diff --git a/tests/controls/pickerbasetest.cpp b/tests/controls/pickerbasetest.cpp index 960ec8588d..1b378b99fb 100644 --- a/tests/controls/pickerbasetest.cpp +++ b/tests/controls/pickerbasetest.cpp @@ -8,6 +8,11 @@ #include "testprec.h" +#if wxUSE_COLOURPICKERCTRL || \ + wxUSE_DIRPICKERCTRL || \ + wxUSE_FILEPICKERCTRL || \ + wxUSE_FONTPICKERCTRL + #include "wx/pickerbase.h" #include "pickerbasetest.h" @@ -63,3 +68,5 @@ void PickerBaseTestCase::Controls() CPPUNIT_ASSERT(base->GetTextCtrl() != NULL); CPPUNIT_ASSERT(base->GetPickerCtrl() != NULL); } + +#endif diff --git a/tests/controls/pickertest.cpp b/tests/controls/pickertest.cpp index 51637a3269..d2cc5a23b3 100644 --- a/tests/controls/pickertest.cpp +++ b/tests/controls/pickertest.cpp @@ -8,6 +8,11 @@ #include "testprec.h" +#if wxUSE_COLOURPICKERCTRL || \ + wxUSE_DIRPICKERCTRL || \ + wxUSE_FILEPICKERCTRL || \ + wxUSE_FONTPICKERCTRL + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -215,3 +220,5 @@ void FontPickerCtrlTestCase::ColourSelection() m_font->GetSelectedColour(), selectedColour); } #endif //wxUSE_FONTPICKERCTRL + +#endif diff --git a/tests/controls/rearrangelisttest.cpp b/tests/controls/rearrangelisttest.cpp index e7f6038502..10a1aca8bd 100644 --- a/tests/controls/rearrangelisttest.cpp +++ b/tests/controls/rearrangelisttest.cpp @@ -8,6 +8,8 @@ #include "testprec.h" +#ifndef __WXOSX_IPHONE__ + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -155,3 +157,5 @@ void RearrangeListTestCase::MoveClientData() CPPUNIT_ASSERT_EQUAL("third", m_rearrange->GetString(1)); CPPUNIT_ASSERT_EQUAL("first", m_rearrange->GetString(2)); } + +#endif diff --git a/tests/controls/spinctrldbltest.cpp b/tests/controls/spinctrldbltest.cpp index 13f72f383c..5b9ba0dfd1 100644 --- a/tests/controls/spinctrldbltest.cpp +++ b/tests/controls/spinctrldbltest.cpp @@ -8,6 +8,8 @@ #include "testprec.h" +#if wxUSE_SPINCTRL + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -220,3 +222,5 @@ void SpinCtrlDoubleTestCase::Digits() CPPUNIT_ASSERT_EQUAL(5, m_spin->GetDigits()); } + +#endif diff --git a/tests/controls/windowtest.cpp b/tests/controls/windowtest.cpp index 1c3fcc1b81..11e1f89ca0 100644 --- a/tests/controls/windowtest.cpp +++ b/tests/controls/windowtest.cpp @@ -127,6 +127,7 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Mouse", "[window]") CHECK(m_window->GetCursor().IsOk()); +#if wxUSE_CARET //A plain window doesn't have a caret CHECK(!m_window->GetCaret()); @@ -134,6 +135,7 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Mouse", "[window]") m_window->SetCaret(caret); CHECK(m_window->GetCaret()->IsOk()); +#endif m_window->CaptureMouse(); @@ -188,6 +190,7 @@ TEST_CASE_METHOD(WindowTestCase, "Window::ToolTip", "[window]") TEST_CASE_METHOD(WindowTestCase, "Window::Help", "[window]") { +#if wxUSE_HELP wxHelpProvider::Set(new wxSimpleHelpProvider()); CHECK( m_window->GetHelpText() == "" ); @@ -195,6 +198,7 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Help", "[window]") m_window->SetHelpText("helptext"); CHECK( m_window->GetHelpText() == "helptext" ); +#endif } TEST_CASE_METHOD(WindowTestCase, "Window::Parent", "[window]") diff --git a/tests/events/propagation.cpp b/tests/events/propagation.cpp index ba9eb60859..7d4ae02252 100644 --- a/tests/events/propagation.cpp +++ b/tests/events/propagation.cpp @@ -248,7 +248,7 @@ private: CPPUNIT_TEST( ScrollWindowWithHandler ); // for unknown reason, this test will cause the tests segmentation failed // under x11, disable it for now. -#if !defined (__WXX11__) +#if !defined (__WXX11__) && wxUSE_MENUS CPPUNIT_TEST( MenuEvent ); #endif #if wxUSE_DOC_VIEW_ARCHITECTURE @@ -265,7 +265,9 @@ private: void ForwardEvent(); void ScrollWindowWithoutHandler(); void ScrollWindowWithHandler(); +#if wxUSE_MENUS void MenuEvent(); +#endif #if wxUSE_DOC_VIEW_ARCHITECTURE void DocView(); #endif // wxUSE_DOC_VIEW_ARCHITECTURE @@ -429,6 +431,8 @@ void EventPropagationTestCase::ScrollWindowWithHandler() CPPUNIT_ASSERT_EQUAL( "apA", g_str ); } +#if wxUSE_MENUS + // Create a menu bar with a single menu containing wxID_APPLY menu item and // attach it to the specified frame. wxMenu* CreateTestMenu(wxFrame* frame) @@ -505,6 +509,7 @@ void EventPropagationTestCase::MenuEvent() ASSERT_MENU_EVENT_RESULT( menu, "aomobowA" ); } +#endif #if wxUSE_DOC_VIEW_ARCHITECTURE diff --git a/tests/interactive/output.cpp b/tests/interactive/output.cpp index 9fdb26cc72..2142975a50 100644 --- a/tests/interactive/output.cpp +++ b/tests/interactive/output.cpp @@ -29,7 +29,9 @@ // ---------------------------------------------------------------------------- #define TEST_DYNLIB +#if wxUSE_MIMETYPE #define TEST_MIME +#endif #define TEST_INFO_FUNCTIONS #define TEST_STACKWALKER #define TEST_STDPATHS diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index a5d2b6f72f..c4db03cfec 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -12,6 +12,8 @@ #include "testprec.h" +#if wxUSE_MENUS + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -811,3 +813,5 @@ TEST_CASE( "wxMenuItemAccelEntry", "[menu][accelentry]" ) } } } + +#endif diff --git a/tests/misc/garbage.cpp b/tests/misc/garbage.cpp index e1a3b47cee..d2e6953eac 100644 --- a/tests/misc/garbage.cpp +++ b/tests/misc/garbage.cpp @@ -139,11 +139,12 @@ void GarbageTestCase::DoLoadFile(const wxString& fullname) ASSERT_FUNC_FAILS(icon.LoadFile, fullname); wxFOR_ALL_VALID_BITMAP_TYPES(ASSERT_FUNC_FAILS_FOR_TYPE, icon.LoadFile, fullname); +#if wxUSE_ANIMATIONCTRL // test wxAnimation wxAnimation anim; ASSERT_FUNC_FAILS(anim.LoadFile, fullname); wxFOR_ALL_VALID_ANIMATION_TYPES(ASSERT_FUNC_FAILS_FOR_TYPE, anim.LoadFile, fullname); - +#endif // test wxDynamicLibrary wxDynamicLibrary lib; @@ -177,11 +178,12 @@ void GarbageTestCase::DoLoadStream(wxInputStream& stream) ASSERT_FUNC_FAILS(img.LoadFile, stream); wxFOR_ALL_VALID_BITMAP_TYPES(ASSERT_FUNC_FAILS_FOR_TYPE, img.LoadFile, stream); +#if wxUSE_ANIMATIONCTRL // test wxAnimation wxAnimation anim; ASSERT_FUNC_FAILS(anim.Load, stream); wxFOR_ALL_VALID_BITMAP_TYPES(ASSERT_FUNC_FAILS_FOR_TYPE, anim.Load, stream); - +#endif /* // test wxHtmlWindow wxHtmlWindow *htmlwin = new wxHtmlWindow(wxTheApp->GetTopWindow()); diff --git a/tests/persistence/dataview.cpp b/tests/persistence/dataview.cpp index 32ed65183b..98c0ee4b88 100644 --- a/tests/persistence/dataview.cpp +++ b/tests/persistence/dataview.cpp @@ -12,6 +12,8 @@ #include "testprec.h" +#if wxUSE_DATAVIEWCTRL + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -170,3 +172,5 @@ TEST_CASE_METHOD(PersistenceTests, "wxPersistDVC", "[persist][wxDataViewCtrl]") delete list->GetParent(); } } + +#endif diff --git a/tests/sizers/boxsizer.cpp b/tests/sizers/boxsizer.cpp index f7df2d95c8..575fdcd3b3 100644 --- a/tests/sizers/boxsizer.cpp +++ b/tests/sizers/boxsizer.cpp @@ -287,6 +287,7 @@ TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::SetMinSize", "[sizer]") CHECK(m_sizer->GetMinSize().x == 100); } +#if wxUSE_LISTBOX TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::BestSizeRespectsMaxSize", "[sizer]") { m_sizer->Clear(); @@ -332,6 +333,7 @@ TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::RecalcSizesRespectsMaxSize1", "[si CHECK(listbox2->GetSize().GetWidth() == maxWidth); } +#endif TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::RecalcSizesRespectsMaxSize2", "[sizer]") {