From 54dfc341ce49d6f10466925d901be5ced25c5975 Mon Sep 17 00:00:00 2001 From: ARATA Mizuki Date: Fri, 19 Feb 2016 10:46:26 +0900 Subject: [PATCH] Add a test for wxFile::ReadAll() with an embedded NUL See #16490. --- tests/file/filetest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/file/filetest.cpp b/tests/file/filetest.cpp index 31870164c3..fdad2d8e4a 100644 --- a/tests/file/filetest.cpp +++ b/tests/file/filetest.cpp @@ -116,6 +116,16 @@ void FileTestCase::DoRoundTripTest(const wxMBConv& conv) wxString dataReadBack(buf, conv, len); CPPUNIT_ASSERT_EQUAL( data, dataReadBack ); } + + { + wxFile fin(tf.GetName(), wxFile::read); + CPPUNIT_ASSERT( fin.IsOpened() ); + + wxString dataReadBack; + CPPUNIT_ASSERT( fin.ReadAll(&dataReadBack, conv) ); + + CPPUNIT_ASSERT_EQUAL( data, dataReadBack ); + } } #endif // wxUSE_UNICODE