second merge of the 2.2 branch (RL)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2000-08-08 06:11:51 +00:00
parent 8fb3bfe20f
commit 3ca6a5f046
138 changed files with 4941 additions and 2278 deletions

View File

@@ -37,11 +37,11 @@
//#define TEST_ARRAYS
//#define TEST_CMDLINE
#define TEST_DATETIME
//#define TEST_DATETIME
//#define TEST_DIR
//#define TEST_DLLLOADER
//#define TEST_EXECUTE
//#define TEST_FILE
#define TEST_FILE
//#define TEST_FILECONF
//#define TEST_HASH
//#define TEST_LIST
@@ -53,9 +53,10 @@
//#define TEST_STRINGS
//#define TEST_THREADS
//#define TEST_TIMER
//#define TEST_VCARD
//#define TEST_VCARD -- don't enable this (VZ)
//#define TEST_WCHAR
//#define TEST_ZIP
//#define TEST_ZLIB
// ----------------------------------------------------------------------------
// test class for container objects
@@ -367,7 +368,7 @@ static void TestFileRead()
puts("File dump:\n----------");
static const size_t len = 1024;
static const off_t len = 1024;
char buf[len];
for ( ;; )
{
@@ -403,6 +404,24 @@ static void TestTextFileRead()
{
printf("Number of lines: %u\n", file.GetLineCount());
printf("Last line: '%s'\n", file.GetLastLine().c_str());
wxString s;
puts("\nDumping the entire file:");
for ( s = file.GetFirstLine(); !file.Eof(); s = file.GetNextLine() )
{
printf("%6u: %s\n", file.GetCurrentLine() + 1, s.c_str());
}
printf("%6u: %s\n", file.GetCurrentLine() + 1, s.c_str());
puts("\nAnd now backwards:");
for ( s = file.GetLastLine();
file.GetCurrentLine() != 0;
s = file.GetPrevLine() )
{
printf("%6u: %s\n", file.GetCurrentLine() + 1, s.c_str());
}
printf("%6u: %s\n", file.GetCurrentLine() + 1, s.c_str());
}
else
{
@@ -1643,6 +1662,58 @@ static void TestZipStreamRead()
#endif // TEST_ZIP
// ----------------------------------------------------------------------------
// ZLIB stream
// ----------------------------------------------------------------------------
#ifdef TEST_ZLIB
#include <wx/zstream.h>
#include <wx/wfstream.h>
static const wxChar *FILENAME_GZ = _T("test.gz");
static const char *TEST_DATA = "hello and hello again";
static void TestZlibStreamWrite()
{
puts("*** Testing Zlib stream reading ***\n");
wxFileOutputStream fileOutStream(FILENAME_GZ);
wxZlibOutputStream ostr(fileOutStream, 0);
printf("Compressing the test string... ");
ostr.Write(TEST_DATA, sizeof(TEST_DATA));
if ( !ostr )
{
puts("(ERROR: failed)");
}
else
{
puts("(ok)");
}
puts("\n----- done ------");
}
static void TestZlibStreamRead()
{
puts("*** Testing Zlib stream reading ***\n");
wxFileInputStream fileInStream(FILENAME_GZ);
wxZlibInputStream istr(fileInStream);
printf("Archive size: %u\n", istr.GetSize());
puts("Dumping the file:");
while ( !istr.Eof() )
{
putchar(istr.GetC());
fflush(stdout);
}
puts("\n----- done ------");
}
#endif // TEST_ZLIB
// ----------------------------------------------------------------------------
// date time
// ----------------------------------------------------------------------------
@@ -2484,7 +2555,25 @@ static void TestTimeMS()
printf("Now = %s\n", dt1.Format("%H:%M:%S:%l").c_str());
printf("UNow = %s\n", dt2.Format("%H:%M:%S:%l").c_str());
printf("Difference is %s\n", (dt2 - dt1).Format("%l").c_str());
printf("Dummy loop: ");
for ( int i = 0; i < 6000; i++ )
{
//for ( int j = 0; j < 10; j++ )
{
wxString s;
s.Printf("%g", sqrt(i));
}
if ( !(i % 100) )
putchar('.');
}
puts(", done");
dt1 = dt2;
dt2 = wxDateTime::UNow();
printf("UNow = %s\n", dt2.Format("%H:%M:%S:%l").c_str());
printf("Loop executed in %s ms\n", (dt2 - dt1).Format("%l").c_str());
puts("\n*** done ***");
}
@@ -3434,7 +3523,8 @@ int main(int argc, char **argv)
#endif // TEST_LOG
#ifdef TEST_FILE
TestFileRead();
if ( 0 )
TestFileRead();
TestTextFileRead();
#endif // TEST_FILE
@@ -3524,10 +3614,10 @@ int main(int argc, char **argv)
TestTimeArithmetics();
TestTimeHolidays();
TestTimeFormat();
TestTimeMS();
TestTimeZoneBug();
}
TestTimeMS();
if ( 0 )
TestInteractive();
#endif // TEST_DATETIME
@@ -3546,6 +3636,12 @@ int main(int argc, char **argv)
TestZipStreamRead();
#endif // TEST_ZIP
#ifdef TEST_ZLIB
if ( 0 )
TestZlibStreamWrite();
TestZlibStreamRead();
#endif // TEST_ZLIB
wxUninitialize();
return 0;