Merge branch 'travis-ansi'

Add ANSI build to Travis CI and make it pass.

See https://github.com/wxWidgets/wxWidgets/pull/2093
This commit is contained in:
Vadim Zeitlin
2020-10-19 13:15:16 +02:00
8 changed files with 40 additions and 3 deletions

View File

@@ -34,6 +34,10 @@ jobs:
compiler: gcc
env: wxGTK_VERSION=3 wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles"
name: wxGTK 3 CMake Ubuntu 18.04
- dist: focal
compiler: gcc
env: wxCONFIGURE_FLAGS="--disable-compat30 --disable-optimise --disable-unicode" wxSKIP_SAMPLES=1
name: wxGTK ANSI Ubuntu 20.04
- os: osx
osx_image: xcode7.3
compiler: clang

View File

@@ -339,9 +339,10 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_)
bool init_result;
int i;
#if wxUSE_UNICODE
int i;
// gtk_init() wants UTF-8, not wchar_t, so convert
char **argvGTK = new char *[argc_ + 1];
for ( i = 0; i < argc_; i++ )

View File

@@ -423,7 +423,10 @@
GCC_TURN_OFF(padded)
#endif // gcc >= 4.6
#if !wxUSE_UTF8_LOCALE_ONLY
// ANSI build hasn't been updated to work without implicit wxString encoding
// and never will be, as it will be removed soon anyhow. And in UTF-8-only
// build we actually want to use implicit encoding (UTF-8).
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
#define wxNO_IMPLICIT_WXSTRING_ENCODING
#endif

View File

@@ -86,7 +86,9 @@ private:
const wxString& destFilePath);
wxString m_fileNameASCII;
#if wxUSE_UNICODE
wxString m_fileNameNonASCII;
#endif // wxUSE_UNICODE
wxString m_fileNameWork;
wxDECLARE_NO_COPY_CLASS(FileFunctionsTestCase);
@@ -110,10 +112,12 @@ void FileFunctionsTestCase::setUp()
wxFileName fn1(wxFileName::GetTempDir(), wxT("wx_file_mask.txt"));
m_fileNameASCII = fn1.GetFullPath();
#if wxUSE_UNICODE
// This file name is 'wx_file_mask.txt' in Russian.
wxFileName fn2(wxFileName::GetTempDir(),
wxT("wx_\u043C\u0430\u0441\u043A\u0430_\u0444\u0430\u0439\u043B\u0430.txt"));
m_fileNameNonASCII = fn2.GetFullPath();
#endif // wxUSE_UNICODE
wxFileName fn3(wxFileName::GetTempDir(), wxT("wx_test_copy"));
m_fileNameWork = fn3.GetFullPath();
@@ -126,10 +130,12 @@ void FileFunctionsTestCase::tearDown()
{
wxRemoveFile(m_fileNameASCII);
}
#if wxUSE_UNICODE
if ( wxFileExists(m_fileNameNonASCII) )
{
wxRemoveFile(m_fileNameNonASCII);
}
#endif // wxUSE_UNICODE
if ( wxFileExists(m_fileNameWork) )
{
wxRemoveFile(m_fileNameWork);
@@ -176,8 +182,10 @@ void FileFunctionsTestCase::CreateFile()
{
// Create file name containing ASCII characters only.
DoCreateFile(m_fileNameASCII);
#if wxUSE_UNICODE
// Create file name containing non-ASCII characters.
DoCreateFile(m_fileNameNonASCII);
#endif // wxUSE_UNICODE
}
void FileFunctionsTestCase::DoCreateFile(const wxString& filePath)
@@ -199,8 +207,10 @@ void FileFunctionsTestCase::FileExists()
// Check file name containing ASCII characters only.
DoFileExists(m_fileNameASCII);
#if wxUSE_UNICODE
// Check file name containing non-ASCII characters.
DoFileExists(m_fileNameNonASCII);
#endif // wxUSE_UNICODE
}
void FileFunctionsTestCase::DoFileExists(const wxString& filePath)
@@ -223,8 +233,10 @@ void FileFunctionsTestCase::FindFile()
{
// Find file name containing ASCII characters only.
DoFindFile(m_fileNameASCII);
#if wxUSE_UNICODE
// Find file name containing non-ASCII characters.
DoFindFile(m_fileNameNonASCII);
#endif // wxUSE_UNICODE
}
void FileFunctionsTestCase::DoFindFile(const wxString& filePath)
@@ -283,8 +295,10 @@ void FileFunctionsTestCase::RemoveFile()
{
// Create & remove file with name containing ASCII characters only.
DoRemoveFile(m_fileNameASCII);
#if wxUSE_UNICODE
// Create & remove file with name containing non-ASCII characters.
DoRemoveFile(m_fileNameNonASCII);
#endif // wxUSE_UNICODE
}
void FileFunctionsTestCase::DoRemoveFile(const wxString& filePath)
@@ -305,6 +319,7 @@ void FileFunctionsTestCase::RenameFile()
{
// Verify renaming file with/without overwriting
// when new file already exist/don't exist.
#if wxUSE_UNICODE
DoRenameFile(m_fileNameASCII, m_fileNameNonASCII, false, false);
DoRenameFile(m_fileNameASCII, m_fileNameNonASCII, false, true);
DoRenameFile(m_fileNameASCII, m_fileNameNonASCII, true, false);
@@ -313,6 +328,7 @@ void FileFunctionsTestCase::RenameFile()
DoRenameFile(m_fileNameNonASCII, m_fileNameASCII, false, true);
DoRenameFile(m_fileNameNonASCII, m_fileNameASCII, true, false);
DoRenameFile(m_fileNameNonASCII, m_fileNameASCII, true, true);
#endif // wxUSE_UNICODE
}
void
@@ -378,8 +394,10 @@ FileFunctionsTestCase::DoRenameFile(const wxString& oldFilePath,
void FileFunctionsTestCase::ConcatenateFiles()
{
#if wxUSE_UNICODE
DoConcatFile(m_fileNameASCII, m_fileNameNonASCII, m_fileNameWork);
DoConcatFile(m_fileNameNonASCII, m_fileNameASCII, m_fileNameWork);
#endif // wxUSE_UNICODE
}
void FileFunctionsTestCase::DoConcatFile(const wxString& filePath1,
@@ -525,21 +543,25 @@ void FileFunctionsTestCase::PathOnly()
// Rmdir fails on them on Linux. See ticket #17644.
void FileFunctionsTestCase::Mkdir()
{
#if wxUSE_UNICODE
wxString dirname = wxString::FromUTF8("__wxMkdir_test_dir_with_\xc3\xb6");
const std::string msg = wxString::Format("Dir: %s", dirname).ToStdString();
CPPUNIT_ASSERT_MESSAGE( msg, wxMkdir(dirname) );
CPPUNIT_ASSERT_MESSAGE( msg, wxDirExists(dirname) );
CPPUNIT_ASSERT_MESSAGE( msg, wxRmdir(dirname) );
#endif // wxUSE_UNICODE
}
void FileFunctionsTestCase::Rmdir()
{
#if wxUSE_UNICODE
wxString dirname = wxString::FromUTF8("__wxRmdir_test_dir_with_\xc3\xb6");
const std::string msg = wxString::Format("Dir: %s", dirname).ToStdString();
CPPUNIT_ASSERT_MESSAGE( msg, wxMkdir(dirname) );
CPPUNIT_ASSERT_MESSAGE( msg, wxRmdir(dirname) );
CPPUNIT_ASSERT_MESSAGE( msg, !wxDirExists(dirname) );
#endif // wxUSE_UNICODE
}
/*

View File

@@ -248,9 +248,11 @@ void DataStreamTestCase::StringRW()
wxString s(wxT("Test1"));
CPPUNIT_ASSERT_EQUAL( TestRW(s), s );
#if wxUSE_UNICODE
s.append(2, wxT('\0'));
s.append(wxT("Test2"));
CPPUNIT_ASSERT_EQUAL( TestRW(s), s );
#endif // wxUSE_UNICODE
s = wxString::FromUTF8("\xc3\xbc"); // U+00FC LATIN SMALL LETTER U WITH DIAERESIS
CPPUNIT_ASSERT_EQUAL( TestRW(s), s );

View File

@@ -131,7 +131,7 @@ TEST_CASE("wxStringOutputStream::Tell", "[stream]")
wxString str(s);
CHECK( wxStringOutputStream(&str).TellO() == len );
#if wxUSE_UNICODE
wxMBConvUTF16 convUTF16;
wxStringOutputStream ss16(NULL, convUTF16);
CHECK( ss16.TellO() == 0 );
@@ -144,4 +144,5 @@ TEST_CASE("wxStringOutputStream::Tell", "[stream]")
// The U+2070D character is represented by a surrogate pair in UTF-16.
wxString u2070D = wxString::FromUTF8("\xF0\xA0\x9C\x8D");
CHECK( wxStringOutputStream(&u2070D, convUTF16).TellO() == 4 );
#endif // wxUSE_UNICODE
}

View File

@@ -636,9 +636,11 @@ void StdStringTestCase::StdConversion()
wxStdWideString s8(s4);
CPPUNIT_ASSERT( s8 == "hello" );
#if wxUSE_UNICODE
std::string s9("\xF0\x9F\x90\xB1\0\xE7\x8C\xAB", 9); /* U+1F431 U+0000 U+732B */
wxString s10 = wxString::FromUTF8(s9);
CPPUNIT_ASSERT_EQUAL( s9, s10.ToStdString(wxConvUTF8) );
#endif // wxUSE_UNICODE
std::string s11("xyz\0\xFF", 5); /* an invalid UTF-8 sequence */
CPPUNIT_ASSERT_EQUAL( wxString::FromUTF8(s11), "" );

View File

@@ -260,7 +260,9 @@ void StringTestCase::StaticConstructors()
CPPUNIT_ASSERT_EQUAL( "Hello", wxString::FromUTF8("Hello", 5) );
CPPUNIT_ASSERT_EQUAL( "Hello", wxString::FromUTF8("Hello") );
#if wxUSE_UNICODE
CPPUNIT_ASSERT_EQUAL( 2, wxString::FromUTF8("h\xc3\xa9llo", 3).length() );
#endif // wxUSE_UNICODE
//CPPUNIT_ASSERT_EQUAL( 1, wxString::FromUTF8("", 1).length() );