added trivial test for wxTextInputStream
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18083 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
#define TEST_SOCKETS
|
#define TEST_SOCKETS
|
||||||
#define TEST_STREAMS
|
#define TEST_STREAMS
|
||||||
#define TEST_STRINGS
|
#define TEST_STRINGS
|
||||||
|
#define TEST_TEXTSTREAM
|
||||||
#define TEST_THREADS
|
#define TEST_THREADS
|
||||||
#define TEST_TIMER
|
#define TEST_TIMER
|
||||||
#define TEST_UNICODE
|
#define TEST_UNICODE
|
||||||
@@ -93,7 +94,7 @@
|
|||||||
#undef TEST_ALL
|
#undef TEST_ALL
|
||||||
static const bool TEST_ALL = TRUE;
|
static const bool TEST_ALL = TRUE;
|
||||||
#else
|
#else
|
||||||
#define TEST_DATETIME
|
#define TEST_TEXTSTREAM
|
||||||
|
|
||||||
static const bool TEST_ALL = FALSE;
|
static const bool TEST_ALL = FALSE;
|
||||||
#endif
|
#endif
|
||||||
@@ -5156,6 +5157,45 @@ static void TestTimeCompatibility()
|
|||||||
|
|
||||||
#endif // TEST_DATETIME
|
#endif // TEST_DATETIME
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxTextInput/OutputStream
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef TEST_TEXTSTREAM
|
||||||
|
|
||||||
|
#include "wx/txtstrm.h"
|
||||||
|
#include "wx/wfstream.h"
|
||||||
|
|
||||||
|
static void TestTextInputStream()
|
||||||
|
{
|
||||||
|
wxPuts(_T("\n*** wxTextInputStream test ***"));
|
||||||
|
|
||||||
|
wxFileInputStream fsIn(_T("testdata.fc"));
|
||||||
|
if ( !fsIn.Ok() )
|
||||||
|
{
|
||||||
|
wxPuts(_T("ERROR: couldn't open file."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxTextInputStream tis(fsIn);
|
||||||
|
|
||||||
|
size_t line = 1;
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
|
const wxString s = tis.ReadLine();
|
||||||
|
|
||||||
|
// line could be non empty if the last line of the file isn't
|
||||||
|
// terminated with EOL
|
||||||
|
if ( fsIn.Eof() && s.empty() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
wxPrintf(_T("Line %d: %s\n"), line++, s.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TEST_TEXTSTREAM
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// threads
|
// threads
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -6525,6 +6565,10 @@ int main(int argc, char **argv)
|
|||||||
TestMemoryStream();
|
TestMemoryStream();
|
||||||
#endif // TEST_STREAMS
|
#endif // TEST_STREAMS
|
||||||
|
|
||||||
|
#ifdef TEST_TEXTSTREAM
|
||||||
|
TestTextInputStream();
|
||||||
|
#endif // TEST_TEXTSTREAM
|
||||||
|
|
||||||
#ifdef TEST_THREADS
|
#ifdef TEST_THREADS
|
||||||
int nCPUs = wxThread::GetCPUCount();
|
int nCPUs = wxThread::GetCPUCount();
|
||||||
wxPrintf(_T("This system has %d CPUs\n"), nCPUs);
|
wxPrintf(_T("This system has %d CPUs\n"), nCPUs);
|
||||||
|
Reference in New Issue
Block a user