wxWidgets/tests
Vadim Zeitlin 4502e7563b Fix wxTextInputStream for input starting with BOM-like bytes
Contrary to what a comment in wxTextInputStream::GetChar() said, it is
actually possible to get more than one wide character from a call to
wxMBConv::ToWChar(len+1) even if a previous call to ToWChar(len) failed
to decode anything at all. This happens with wxConvAuto because it keeps
returning an error while it doesn't have enough data to determine if the
input contains a BOM or not, but then returns all the characters
examined so far at once if it turns out that there was no BOM, after
all.

The simplest case in which this created problems was just input starting
with a NUL byte as it as this could be a start of UTF-32BE BOM.

The fix consists in keeping all the bytes read but not yet decoded in
the m_lastBytes buffer and retrying to decode them during the next
GetChar() call. This implies keeping track of how much valid data is
there in m_lastBytes exactly, as we can't discard the already decoded
data immediately, but need to keep it in the buffer too, in order to
allow implementing UngetLast(). Incidentally, UngetLast() was totally
broken for UTF-16/32 input (containing NUL bytes in the middle of the
characters) before and this change fixes this as a side effect.

Also add test cases for previously failing inputs.
2017-11-09 23:49:59 +01:00
..
any Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
archive Fix archivers test suite broken by transition to Catch 2017-11-07 13:50:47 +01:00
arrays Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
base64 Fix some memory leaks in the tests 2017-10-01 09:41:49 -07:00
benchmarks Update to bakefile 0.2.11 and rebake everything 2017-10-21 17:42:30 +02:00
cmdline Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
config Fix harmless signed/unsigned comparison warnings in a test 2017-11-02 01:53:21 +01:00
controls Wait for the focus event to occur in the unit test 2017-11-07 15:44:18 +01:00
datetime More use of wxFALLTHROUGH 2017-11-02 08:56:29 -07:00
drawing Merge branch 'rmv_symbols_3' of https://github.com/catalinr/wxWidgets 2017-02-20 17:46:45 +01:00
events Disable wxPaintEvent propagation tests for wxGTK3 2017-11-07 16:37:25 +01:00
exec Avoid launching interactive programs in unattended tests 2017-11-05 17:16:39 +01:00
file Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
filekind Factor out TempFile class and reuse it in other tests 2017-11-05 17:28:24 +01:00
filename Fix wxMSW test build in UTF-8 and ANSI build 2017-06-22 02:04:50 +04:00
filesys Return valie file URLs from wxFileSystem::FileNameToURL() 2016-02-05 22:43:23 +01:00
font Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
fontmap Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
formatconverter Remove all lines containing cvs/svn "$Id$" keyword. 2013-07-26 16:02:46 +00:00
fswatcher Fix harmless signed/unsigned comparison warnings in a test 2017-11-02 01:53:21 +01:00
fuzz Add a helper for running fuzz function with a single input 2017-10-28 15:12:14 +02:00
geometry Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
graphics Fix DrawPoint() test 2017-11-05 09:35:43 -08:00
hashes Don't use gcc 4.8 workaround in the hash test with clang 2017-03-11 03:37:07 +01:00
html Avoid asserts when destroying windows with mouse capture in tests 2016-06-29 18:26:11 +02:00
image Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
interactive Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
intl Strip mnemonics from CJK translations of menu items too 2016-06-26 18:36:11 +02:00
lists Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
log Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
longlong Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
mbconv Add subsections to MBConvTestCase::NonBMPCharTests() 2017-11-09 23:38:03 +01:00
menu Use HTTPS with Trac links. 2017-07-04 13:15:14 -06:00
misc Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
net Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
regex Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
scopeguard Remove all lines containing cvs/svn "$Id$" keyword. 2013-07-26 16:02:46 +00:00
sizers Rename wxBoxSizer::m_minSize to avoid clash with the base class 2015-10-11 01:00:38 +02:00
streams Fix wxTextInputStream for input starting with BOM-like bytes 2017-11-09 23:49:59 +01:00
strings Fix a unit test in UTF-8 build using UTF-8 strings only 2017-11-03 23:11:32 +01:00
textfile Use HTTPS with Trac links. 2017-07-04 13:15:14 -06:00
thread Work around Catch multi-thread unsafety 2017-11-02 01:53:25 +01:00
toplevel Disable wxTopLevelWindow::IsActive() unit test for wxGTK 2017-11-07 16:16:08 +01:00
uris Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
validators This statement that will cause segmentation fault before. Now it ok and enable it 2014-09-23 17:44:30 +00:00
vectors Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
weakref Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
window Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
xlocale Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
xml Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
asserthelper.cpp Replace anonymous namespace with a named one in the test helpers. 2014-07-14 19:17:12 +00:00
asserthelper.h Replace anonymous namespace with a named one in the test helpers. 2014-07-14 19:17:12 +00:00
descrip.mms Fixes for OpenVMS on IA64 2011-09-29 13:47:38 +00:00
dummy.cpp Empty line at the end. 2004-11-22 15:12:29 +00:00
horse.ani add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.bmp add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.cur add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.gif add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.ico add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.jpg add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.pcx add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.png add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.pnm add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.tga add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.tif add wxImage test units to test loading from both seekable and non-seekable streams 2009-06-01 11:46:36 +00:00
horse.xpm Convert all XPM files to Unix EOLs. 2015-03-19 21:46:05 +01:00
makefile.bcc Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
makefile.gcc Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
Makefile.in Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
makefile.vc Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
runtests.bat Don't use "-t" option when running tests any longer 2017-11-02 01:53:29 +01:00
test_gui_vc10.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_gui_vc11.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_gui_vc12.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_gui_vc14.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_gui_vc15.sln Add MSVS 2017 solution file for the tests 2017-03-11 17:55:08 +01:00
test_gui.vcxproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_gui.vcxproj.filters Use canonical format for MSVS project/solution files 2017-03-18 15:14:26 +01:00
test_vc7_test_drawing.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc7_test_drawingplugin.vcproj Update to bakefile 0.2.11 and rebake everything 2017-10-21 17:42:30 +02:00
test_vc7_test_gui.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc7_test.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc8_test_drawing.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc8_test_drawingplugin.vcproj Update to bakefile 0.2.11 and rebake everything 2017-10-21 17:42:30 +02:00
test_vc8_test_gui.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc8_test.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc9_test_drawing.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc9_test_drawingplugin.vcproj Update to bakefile 0.2.11 and rebake everything 2017-10-21 17:42:30 +02:00
test_vc9_test_gui.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc9_test.vcproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test_vc10.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_vc11.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_vc12.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_vc14.sln Add MSVS 2010, 2012, 2013 and 2015 projects for the tests 2016-02-05 22:43:23 +01:00
test_vc15.sln Use canonical format for MSVS project/solution files 2017-03-18 15:14:26 +01:00
test.bkl Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test.cpp Add more new lines around GTK errors in the test suite 2017-11-07 16:21:38 +01:00
test.vcxproj Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
test.vcxproj.filters Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
testableframe.cpp Show wxTestableFrame from its ctor 2016-02-27 02:41:18 +01:00
testableframe.h Remove all lines containing cvs/svn "$Id$" keyword. 2013-07-26 16:02:46 +00:00
testdata.fc moved Unicode tests to testsuite (patch 943945) 2004-04-30 20:26:14 +00:00
testdate.h Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
testfile.h Factor out TempFile class and reuse it in other tests 2017-11-05 17:28:24 +01:00
testimage.h Replace CppUnit with Catch for unit tests 2017-11-02 01:53:16 +01:00
testprec.h Disable tests using wxUIActionSimulator under non-MSW platforms 2017-11-05 17:51:55 +01:00