From: Michael Wetherell Date: Sat, 12 Feb 2005 21:53:51 +0000 (+0000) Subject: Rename wxGetFileType to wxGetFileKind X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0912690b65b3c58c0e12870fb971675ca5572ae6 Rename wxGetFileType to wxGetFileKind git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/ffile.tex b/docs/latex/wx/ffile.tex index 5dd496b9be..3db99c9ffd 100644 --- a/docs/latex/wx/ffile.tex +++ b/docs/latex/wx/ffile.tex @@ -145,19 +145,19 @@ if the file is not opened. Flushes the file and returns \true on success. -\membersection{wxFFile::GetFileType}\label{wxffilegetfiletype} +\membersection{wxFFile::GetKind}\label{wxffilegetfilekind} -\constfunc{wxFileTypeEnum}{GetFileType}{\void} +\constfunc{wxFileKind}{GetKind}{\void} Returns the type of the file. Possible return values are: \begin{verbatim} -enum wxFileTypeEnum +enum wxFileKind { - wxFILE_TYPE_UNKNOWN, - wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets - wxFILE_TYPE_TERMINAL, // a tty - wxFILE_TYPE_PIPE // a pipe + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe }; \end{verbatim} diff --git a/docs/latex/wx/file.tex b/docs/latex/wx/file.tex index f9bb2c6903..78b5515dfc 100644 --- a/docs/latex/wx/file.tex +++ b/docs/latex/wx/file.tex @@ -200,19 +200,19 @@ Note that wxFile::Flush is not implemented on some Windows compilers due to a missing fsync function, which reduces the usefulness of this function (it can still be called but it will do nothing on unsupported compilers). -\membersection{wxFile::GetFileType}\label{wxfilegetfiletype} +\membersection{wxFile::GetKind}\label{wxfilegetfilekind} -\constfunc{wxFileTypeEnum}{GetFileType}{\void} +\constfunc{wxFileKind}{GetKind}{\void} Returns the type of the file. Possible return values are: \begin{verbatim} -enum wxFileTypeEnum +enum wxFileKind { - wxFILE_TYPE_UNKNOWN, - wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets - wxFILE_TYPE_TERMINAL, // a tty - wxFILE_TYPE_PIPE // a pipe + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe }; \end{verbatim} diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index ad28eda84b..c6808d5e65 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -108,7 +108,7 @@ the corresponding topic. \helpref{wxGetElapsedTime}{wxgetelapsedtime}\\ \helpref{wxGetEmailAddress}{wxgetemailaddress}\\ \helpref{wxGetEnv}{wxgetenv}\\ -\helpref{wxGetFileType}{wxgetfiletype}\\ +\helpref{wxGetFileKind}{wxgetfilekind}\\ \helpref{wxGetFontFromUser}{wxgetfontfromuser}\\ \helpref{wxGetFreeMemory}{wxgetfreememory}\\ \helpref{wxGetFullHostName}{wxgetfullhostname}\\ @@ -1016,21 +1016,21 @@ Mac OS and generic Unix provided the system has {\tt statfs()} function. This function first appeared in wxWidgets 2.3.2. -\membersection{::wxGetFileType}\label{wxgetfiletype} +\membersection{::wxGetFileKind}\label{wxgetfilekind} -\func{wxFileTypeEnum}{wxGetFileType}{\param{int }{fd}} +\func{wxFileKind}{wxGetFileKind}{\param{int }{fd}} -\func{wxFileTypeEnum}{wxGetFileType}{\param{FILE *}{fp}} +\func{wxFileKind}{wxGetFileKind}{\param{FILE *}{fp}} Returns the type of an open file. Possible return values are: \begin{verbatim} -enum wxFileTypeEnum +enum wxFileKind { - wxFILE_TYPE_UNKNOWN, - wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets - wxFILE_TYPE_TERMINAL, // a tty - wxFILE_TYPE_PIPE // a pipe + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe }; \end{verbatim} diff --git a/include/wx/ffile.h b/include/wx/ffile.h index 2e19a906ec..f61a97fd29 100644 --- a/include/wx/ffile.h +++ b/include/wx/ffile.h @@ -97,7 +97,7 @@ public: // get the file name const wxString& GetName() const { return m_name; } // type such as disk or pipe - wxFileTypeEnum GetFileType() const { return wxGetFileType(m_fp); } + wxFileKind GetKind() const { return wxGetFileKind(m_fp); } // dtor closes the file if opened ~wxFFile() { Close(); } diff --git a/include/wx/file.h b/include/wx/file.h index 1656c175ad..3382610c57 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -126,7 +126,7 @@ public: // has an error occured? bool Error() const { return m_error; } // type such as disk or pipe - wxFileTypeEnum GetFileType() const { return wxGetFileType(m_fd); } + wxFileKind GetKind() const { return wxGetFileKind(m_fd); } // dtor closes the file if opened ~wxFile() { Close(); } diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 80cc1db89c..976292adb9 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -122,12 +122,12 @@ enum wxSeekMode wxFromEnd }; -enum wxFileTypeEnum +enum wxFileKind { - wxFILE_TYPE_UNKNOWN, - wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets - wxFILE_TYPE_TERMINAL, // a tty - wxFILE_TYPE_PIPE // a pipe + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe }; // ---------------------------------------------------------------------------- @@ -464,8 +464,8 @@ WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777); WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); // Return the type of an open file -WXDLLIMPEXP_BASE wxFileTypeEnum wxGetFileType(int fd); -inline wxFileTypeEnum wxGetFileType(FILE *fp) { return wxGetFileType(fileno(fp)); } +WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); +inline wxFileKind wxGetFileKind (FILE *fp) { return wxGetFileKind(fileno(fp)); } // compatibility defines, don't use in new code #define wxDirExists wxPathExists diff --git a/include/wx/wfstream.h b/include/wx/wfstream.h index 0b4be35d9b..2883714874 100644 --- a/include/wx/wfstream.h +++ b/include/wx/wfstream.h @@ -41,7 +41,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return m_file->IsOpened(); } - bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; } + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: wxFileInputStream(); @@ -70,7 +70,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return m_file->IsOpened(); } - bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; } + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: wxFileOutputStream(); @@ -111,7 +111,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return m_file->IsOpened(); } - bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; } + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: wxFFileInputStream(); @@ -140,7 +140,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return m_file->IsOpened(); } - bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; } + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: wxFFileOutputStream(); diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index b780caad9a..ab1e71d345 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1858,43 +1858,43 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) // Return the type of an open file // -wxFileTypeEnum wxGetFileType(int fd) +wxFileKind wxGetFileKind(int fd) { if (isatty(fd)) - return wxFILE_TYPE_TERMINAL; + return wxFILE_KIND_TERMINAL; #if defined __WXMSW__ switch (::GetFileType(wxGetOSFHandle(fd)) & ~FILE_TYPE_REMOTE) { case FILE_TYPE_DISK: - return wxFILE_TYPE_DISK; + return wxFILE_KIND_DISK; case FILE_TYPE_PIPE: - return wxFILE_TYPE_PIPE; + return wxFILE_KIND_PIPE; } - return wxFILE_TYPE_UNKNOWN; + return wxFILE_KIND_UNKNOWN; #elif defined __UNIX__ struct stat st; fstat(fd, &st); if (S_ISFIFO(st.st_mode)) - return wxFILE_TYPE_PIPE; + return wxFILE_KIND_PIPE; if (!S_ISREG(st.st_mode)) - return wxFILE_TYPE_UNKNOWN; + return wxFILE_KIND_UNKNOWN; #if defined __VMS__ if (st.st_fab_rfm != FAB$C_STMLF) - return wxFILE_TYPE_UNKNOWN; + return wxFILE_KIND_UNKNOWN; #endif - return wxFILE_TYPE_DISK; + return wxFILE_KIND_DISK; #else if (lseek(fd, 0, SEEK_CUR) != -1) - return wxFILE_TYPE_DISK; + return wxFILE_KIND_DISK; else - return wxFILE_TYPE_UNKNOWN; + return wxFILE_KIND_UNKNOWN; #endif } diff --git a/tests/Makefile.in b/tests/Makefile.in index 764a2da5c9..039da28f09 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -49,9 +49,9 @@ TEST_OBJECTS = \ test_arrays.o \ test_datetimetest.o \ test_fileconftest.o \ + test_filekind.o \ test_filenametest.o \ test_filesystest.o \ - test_filetype.o \ test_fontmaptest.o \ test_formatconvertertest.o \ test_hashes.o \ @@ -255,15 +255,15 @@ test_datetimetest.o: $(srcdir)/datetime/datetimetest.cpp $(TEST_ODEP) test_fileconftest.o: $(srcdir)/fileconf/fileconftest.cpp $(TEST_ODEP) $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/fileconf/fileconftest.cpp +test_filekind.o: $(srcdir)/filekind/filekind.cpp $(TEST_ODEP) + $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filekind/filekind.cpp + test_filenametest.o: $(srcdir)/filename/filenametest.cpp $(TEST_ODEP) $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filename/filenametest.cpp test_filesystest.o: $(srcdir)/filesys/filesystest.cpp $(TEST_ODEP) $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filesys/filesystest.cpp -test_filetype.o: $(srcdir)/filetype/filetype.cpp $(TEST_ODEP) - $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filetype/filetype.cpp - test_fontmaptest.o: $(srcdir)/fontmap/fontmaptest.cpp $(TEST_ODEP) $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/fontmap/fontmaptest.cpp diff --git a/tests/filekind/filekind.cpp b/tests/filekind/filekind.cpp new file mode 100644 index 0000000000..7cb6aa38ca --- /dev/null +++ b/tests/filekind/filekind.cpp @@ -0,0 +1,202 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: tests/filetype/filetype.cpp +// Purpose: Test wxGetFileKind and wxStreamBase::IsSeekable +// Author: Mike Wetherell +// RCS-ID: $Id$ +// Copyright: (c) 2005 Mike Wetherell +// Licence: wxWidgets licence +/////////////////////////////////////////////////////////////////////////////// + +#include "testprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#ifdef __UNIX__ + #include +#endif + +#include "wx/file.h" +#include "wx/ffile.h" +#include "wx/wfstream.h" +#include "wx/filename.h" +#include "wx/socket.h" +#include "wx/sckstrm.h" +#include "wx/mstream.h" + +#if wxUSE_STREAMS + +/////////////////////////////////////////////////////////////////////////////// +// The test case + +class FileKindTestCase : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(FileKindTestCase); + CPPUNIT_TEST(File); +#if defined __UNIX__ || defined _MSC_VER || defined __MINGW32__ + CPPUNIT_TEST(Pipe); +#endif +#if defined __UNIX__ + CPPUNIT_TEST(Socket); +#endif + CPPUNIT_TEST(Stdin); + CPPUNIT_TEST(MemoryStream); + CPPUNIT_TEST(SocketStream); + CPPUNIT_TEST_SUITE_END(); + + void File(); + void Pipe(); + void Socket(); + void Stdin(); + void MemoryStream(); + void SocketStream(); + + void TestFILE(wxFFile& file, bool expected); + void TestFd(wxFile& file, bool expected); +}; + +// test a wxFFile and wxFFileInput/OutputStreams of a known type +// +void FileKindTestCase::TestFILE(wxFFile& file, bool expected) +{ + CPPUNIT_ASSERT(file.IsOpened()); + CPPUNIT_ASSERT((wxGetFileKind(file.fp()) == wxFILE_KIND_DISK) == expected); + CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected); + + wxFFileInputStream inStream(file); + CPPUNIT_ASSERT(inStream.IsSeekable() == expected); + + wxFFileOutputStream outStream(file); + CPPUNIT_ASSERT(outStream.IsSeekable() == expected); +} + +// test a wxFile and wxFileInput/OutputStreams of a known type +// +void FileKindTestCase::TestFd(wxFile& file, bool expected) +{ + CPPUNIT_ASSERT(file.IsOpened()); + CPPUNIT_ASSERT((wxGetFileKind(file.fd()) == wxFILE_KIND_DISK) == expected); + CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected); + + wxFileInputStream inStream(file); + CPPUNIT_ASSERT(inStream.IsSeekable() == expected); + + wxFileOutputStream outStream(file); + CPPUNIT_ASSERT(outStream.IsSeekable() == expected); +} + +struct TempFile +{ + ~TempFile() { if (!m_name.IsEmpty()) wxRemoveFile(m_name); } + wxString m_name; +}; + +// test with an ordinary file +// +void FileKindTestCase::File() +{ + TempFile tmp; // put first + wxFile file; + tmp.m_name = wxFileName::CreateTempFileName(_T("wxft"), &file); + TestFd(file, true); + file.Close(); + + wxFFile ffile(tmp.m_name); + TestFILE(ffile, true); +} + +// test with a pipe +// +#if defined __UNIX__ || defined _MSC_VER || defined __MINGW32__ +void FileKindTestCase::Pipe() +{ + int afd[2]; +#ifdef __UNIX__ + pipe(afd); +#else + _pipe(afd, 256, O_BINARY); +#endif + + wxFile file0(afd[0]); + wxFile file1(afd[1]); + TestFd(file0, false); + file0.Detach(); + + wxFFile ffile(fdopen(afd[0], "r")); + TestFILE(ffile, false); +} +#endif + +// test with a socket +// +#if defined __UNIX__ +void FileKindTestCase::Socket() +{ + int s = socket(PF_INET, SOCK_STREAM, 0); + + wxFile file(s); + TestFd(file, false); + file.Detach(); + + wxFFile ffile(fdopen(s, "r")); + TestFILE(ffile, false); +} +#endif + +// Socket streams should be non-seekable +// +#if wxUSE_SOCKETS +void FileKindTestCase::SocketStream() +{ + wxSocketClient client; + wxSocketInputStream inStream(client); + CPPUNIT_ASSERT(!inStream.IsSeekable()); + wxSocketOutputStream outStream(client); + CPPUNIT_ASSERT(!outStream.IsSeekable()); + + wxBufferedInputStream nonSeekableBufferedInput(inStream); + CPPUNIT_ASSERT(!nonSeekableBufferedInput.IsSeekable()); + wxBufferedOutputStream nonSeekableBufferedOutput(outStream); + CPPUNIT_ASSERT(!nonSeekableBufferedOutput.IsSeekable()); +} +#endif + +// Memory streams should be seekable +// +void FileKindTestCase::MemoryStream() +{ + char buf[20]; + wxMemoryInputStream inStream(buf, sizeof(buf)); + CPPUNIT_ASSERT(inStream.IsSeekable()); + wxMemoryOutputStream outStream(buf, sizeof(buf)); + CPPUNIT_ASSERT(outStream.IsSeekable()); + + wxBufferedInputStream seekableBufferedInput(inStream); + CPPUNIT_ASSERT(seekableBufferedInput.IsSeekable()); + wxBufferedOutputStream seekableBufferedOutput(outStream); + CPPUNIT_ASSERT(seekableBufferedOutput.IsSeekable()); +} + +// Stdin will usually be a terminal, if so then test it +// +void FileKindTestCase::Stdin() +{ + if (isatty(0)) + CPPUNIT_ASSERT(wxGetFileKind(0) == wxFILE_KIND_TERMINAL); + if (isatty(fileno(stdin))) + CPPUNIT_ASSERT(wxGetFileKind(stdin) == wxFILE_KIND_TERMINAL); +} + +// register in the unnamed registry so that these tests are run by default +CPPUNIT_TEST_SUITE_REGISTRATION(FileKindTestCase); + +// also include in it's own registry so that these tests can be run alone +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(FileKindTestCase, "FileKindTestCase"); + +#endif // wxUSE_STREAMS diff --git a/tests/filetype/filetype.cpp b/tests/filetype/filetype.cpp deleted file mode 100644 index 5eb821645a..0000000000 --- a/tests/filetype/filetype.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: tests/filetype/filetype.cpp -// Purpose: Test wxGetFileType and wxStreamBase::IsSeekable -// Author: Mike Wetherell -// RCS-ID: $Id$ -// Copyright: (c) 2005 Mike Wetherell -// Licence: wxWidgets licence -/////////////////////////////////////////////////////////////////////////////// - -#include "testprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// for all others, include the necessary headers -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#ifdef __UNIX__ - #include -#endif - -#include "wx/file.h" -#include "wx/ffile.h" -#include "wx/wfstream.h" -#include "wx/filename.h" -#include "wx/socket.h" -#include "wx/sckstrm.h" -#include "wx/mstream.h" - -#if wxUSE_STREAMS - -/////////////////////////////////////////////////////////////////////////////// -// The test case - -class FileTypeTestCase : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(FileTypeTestCase); - CPPUNIT_TEST(File); -#if defined __UNIX__ || defined _MSC_VER || defined __MINGW32__ - CPPUNIT_TEST(Pipe); -#endif -#if defined __UNIX__ - CPPUNIT_TEST(Socket); -#endif - CPPUNIT_TEST(Stdin); - CPPUNIT_TEST(MemoryStream); - CPPUNIT_TEST(SocketStream); - CPPUNIT_TEST_SUITE_END(); - - void File(); - void Pipe(); - void Socket(); - void Stdin(); - void MemoryStream(); - void SocketStream(); - - void TestFILE(wxFFile& file, bool expected); - void TestFd(wxFile& file, bool expected); -}; - -// test a wxFFile and wxFFileInput/OutputStreams of a known type -// -void FileTypeTestCase::TestFILE(wxFFile& file, bool expected) -{ - CPPUNIT_ASSERT(file.IsOpened()); - CPPUNIT_ASSERT((wxGetFileType(file.fp()) == wxFILE_TYPE_DISK) == expected); - CPPUNIT_ASSERT((file.GetFileType() == wxFILE_TYPE_DISK) == expected); - - wxFFileInputStream inStream(file); - CPPUNIT_ASSERT(inStream.IsSeekable() == expected); - - wxFFileOutputStream outStream(file); - CPPUNIT_ASSERT(outStream.IsSeekable() == expected); -} - -// test a wxFile and wxFileInput/OutputStreams of a known type -// -void FileTypeTestCase::TestFd(wxFile& file, bool expected) -{ - CPPUNIT_ASSERT(file.IsOpened()); - CPPUNIT_ASSERT((wxGetFileType(file.fd()) == wxFILE_TYPE_DISK) == expected); - CPPUNIT_ASSERT((file.GetFileType() == wxFILE_TYPE_DISK) == expected); - - wxFileInputStream inStream(file); - CPPUNIT_ASSERT(inStream.IsSeekable() == expected); - - wxFileOutputStream outStream(file); - CPPUNIT_ASSERT(outStream.IsSeekable() == expected); -} - -struct TempFile -{ - ~TempFile() { if (!m_name.IsEmpty()) wxRemoveFile(m_name); } - wxString m_name; -}; - -// test with an ordinary file -// -void FileTypeTestCase::File() -{ - TempFile tmp; // put first - wxFile file; - tmp.m_name = wxFileName::CreateTempFileName(_T("wxft"), &file); - TestFd(file, true); - file.Close(); - - wxFFile ffile(tmp.m_name); - TestFILE(ffile, true); -} - -// test with a pipe -// -#if defined __UNIX__ || defined _MSC_VER || defined __MINGW32__ -void FileTypeTestCase::Pipe() -{ - int afd[2]; -#ifdef __UNIX__ - pipe(afd); -#else - _pipe(afd, 256, O_BINARY); -#endif - - wxFile file0(afd[0]); - wxFile file1(afd[1]); - TestFd(file0, false); - file0.Detach(); - - wxFFile ffile(fdopen(afd[0], "r")); - TestFILE(ffile, false); -} -#endif - -// test with a socket -// -#if defined __UNIX__ -void FileTypeTestCase::Socket() -{ - int s = socket(PF_INET, SOCK_STREAM, 0); - - wxFile file(s); - TestFd(file, false); - file.Detach(); - - wxFFile ffile(fdopen(s, "r")); - TestFILE(ffile, false); -} -#endif - -// Socket streams should be non-seekable -// -#if wxUSE_SOCKETS -void FileTypeTestCase::SocketStream() -{ - wxSocketClient client; - wxSocketInputStream inStream(client); - CPPUNIT_ASSERT(!inStream.IsSeekable()); - wxSocketOutputStream outStream(client); - CPPUNIT_ASSERT(!outStream.IsSeekable()); - - wxBufferedInputStream nonSeekableBufferedInput(inStream); - CPPUNIT_ASSERT(!nonSeekableBufferedInput.IsSeekable()); - wxBufferedOutputStream nonSeekableBufferedOutput(outStream); - CPPUNIT_ASSERT(!nonSeekableBufferedOutput.IsSeekable()); -} -#endif - -// Memory streams should be seekable -// -void FileTypeTestCase::MemoryStream() -{ - char buf[20]; - wxMemoryInputStream inStream(buf, sizeof(buf)); - CPPUNIT_ASSERT(inStream.IsSeekable()); - wxMemoryOutputStream outStream(buf, sizeof(buf)); - CPPUNIT_ASSERT(outStream.IsSeekable()); - - wxBufferedInputStream seekableBufferedInput(inStream); - CPPUNIT_ASSERT(seekableBufferedInput.IsSeekable()); - wxBufferedOutputStream seekableBufferedOutput(outStream); - CPPUNIT_ASSERT(seekableBufferedOutput.IsSeekable()); -} - -// Stdin will usually be a terminal, if so then test it -// -void FileTypeTestCase::Stdin() -{ - if (isatty(0)) - CPPUNIT_ASSERT(wxGetFileType(0) == wxFILE_TYPE_TERMINAL); - if (isatty(fileno(stdin))) - CPPUNIT_ASSERT(wxGetFileType(stdin) == wxFILE_TYPE_TERMINAL); -} - -// register in the unnamed registry so that these tests are run by default -CPPUNIT_TEST_SUITE_REGISTRATION(FileTypeTestCase); - -// also include in it's own registry so that these tests can be run alone -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(FileTypeTestCase, "FileTypeTestCase"); - -#endif // wxUSE_STREAMS diff --git a/tests/makefile.bcc b/tests/makefile.bcc index 2f3720e4b9..ab60059c57 100644 --- a/tests/makefile.bcc +++ b/tests/makefile.bcc @@ -40,9 +40,9 @@ TEST_OBJECTS = \ $(OBJS)\test_arrays.obj \ $(OBJS)\test_datetimetest.obj \ $(OBJS)\test_fileconftest.obj \ + $(OBJS)\test_filekind.obj \ $(OBJS)\test_filenametest.obj \ $(OBJS)\test_filesystest.obj \ - $(OBJS)\test_filetype.obj \ $(OBJS)\test_fontmaptest.obj \ $(OBJS)\test_formatconvertertest.obj \ $(OBJS)\test_hashes.obj \ @@ -267,13 +267,13 @@ $(OBJS)\test_datetimetest.obj: .\datetime\datetimetest.cpp $(OBJS)\test_fileconftest.obj: .\fileconf\fileconftest.cpp $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $** -$(OBJS)\test_filenametest.obj: .\filename\filenametest.cpp +$(OBJS)\test_filekind.obj: .\filekind\filekind.cpp $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $** -$(OBJS)\test_filesystest.obj: .\filesys\filesystest.cpp +$(OBJS)\test_filenametest.obj: .\filename\filenametest.cpp $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $** -$(OBJS)\test_filetype.obj: .\filetype\filetype.cpp +$(OBJS)\test_filesystest.obj: .\filesys\filesystest.cpp $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $** $(OBJS)\test_fontmaptest.obj: .\fontmap\fontmaptest.cpp diff --git a/tests/makefile.gcc b/tests/makefile.gcc index 6ae8c2a524..0ade361a4a 100644 --- a/tests/makefile.gcc +++ b/tests/makefile.gcc @@ -31,9 +31,9 @@ TEST_OBJECTS = \ $(OBJS)\test_arrays.o \ $(OBJS)\test_datetimetest.o \ $(OBJS)\test_fileconftest.o \ + $(OBJS)\test_filekind.o \ $(OBJS)\test_filenametest.o \ $(OBJS)\test_filesystest.o \ - $(OBJS)\test_filetype.o \ $(OBJS)\test_fontmaptest.o \ $(OBJS)\test_formatconvertertest.o \ $(OBJS)\test_hashes.o \ @@ -256,13 +256,13 @@ $(OBJS)\test_datetimetest.o: ./datetime/datetimetest.cpp $(OBJS)\test_fileconftest.o: ./fileconf/fileconftest.cpp $(CXX) -c -o $@ $(TEST_CXXFLAGS) $< -$(OBJS)\test_filenametest.o: ./filename/filenametest.cpp +$(OBJS)\test_filekind.o: ./filekind/filekind.cpp $(CXX) -c -o $@ $(TEST_CXXFLAGS) $< -$(OBJS)\test_filesystest.o: ./filesys/filesystest.cpp +$(OBJS)\test_filenametest.o: ./filename/filenametest.cpp $(CXX) -c -o $@ $(TEST_CXXFLAGS) $< -$(OBJS)\test_filetype.o: ./filetype/filetype.cpp +$(OBJS)\test_filesystest.o: ./filesys/filesystest.cpp $(CXX) -c -o $@ $(TEST_CXXFLAGS) $< $(OBJS)\test_fontmaptest.o: ./fontmap/fontmaptest.cpp diff --git a/tests/makefile.vc b/tests/makefile.vc index 1c47dd5492..10d9f2fda2 100644 --- a/tests/makefile.vc +++ b/tests/makefile.vc @@ -33,9 +33,9 @@ TEST_OBJECTS = \ $(OBJS)\test_arrays.obj \ $(OBJS)\test_datetimetest.obj \ $(OBJS)\test_fileconftest.obj \ + $(OBJS)\test_filekind.obj \ $(OBJS)\test_filenametest.obj \ $(OBJS)\test_filesystest.obj \ - $(OBJS)\test_filetype.obj \ $(OBJS)\test_fontmaptest.obj \ $(OBJS)\test_formatconvertertest.obj \ $(OBJS)\test_hashes.obj \ @@ -368,13 +368,13 @@ $(OBJS)\test_datetimetest.obj: .\datetime\datetimetest.cpp $(OBJS)\test_fileconftest.obj: .\fileconf\fileconftest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $** -$(OBJS)\test_filenametest.obj: .\filename\filenametest.cpp +$(OBJS)\test_filekind.obj: .\filekind\filekind.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $** -$(OBJS)\test_filesystest.obj: .\filesys\filesystest.cpp +$(OBJS)\test_filenametest.obj: .\filename\filenametest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $** -$(OBJS)\test_filetype.obj: .\filetype\filetype.cpp +$(OBJS)\test_filesystest.obj: .\filesys\filesystest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $** $(OBJS)\test_fontmaptest.obj: .\fontmap\fontmaptest.cpp diff --git a/tests/makefile.wat b/tests/makefile.wat index 40cd9bed32..2b5866d43c 100644 --- a/tests/makefile.wat +++ b/tests/makefile.wat @@ -211,9 +211,9 @@ TEST_OBJECTS = & $(OBJS)\test_arrays.obj & $(OBJS)\test_datetimetest.obj & $(OBJS)\test_fileconftest.obj & + $(OBJS)\test_filekind.obj & $(OBJS)\test_filenametest.obj & $(OBJS)\test_filesystest.obj & - $(OBJS)\test_filetype.obj & $(OBJS)\test_fontmaptest.obj & $(OBJS)\test_formatconvertertest.obj & $(OBJS)\test_hashes.obj & @@ -316,13 +316,13 @@ $(OBJS)\test_datetimetest.obj : .AUTODEPEND .\datetime\datetimetest.cpp $(OBJS)\test_fileconftest.obj : .AUTODEPEND .\fileconf\fileconftest.cpp $(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $< -$(OBJS)\test_filenametest.obj : .AUTODEPEND .\filename\filenametest.cpp +$(OBJS)\test_filekind.obj : .AUTODEPEND .\filekind\filekind.cpp $(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $< -$(OBJS)\test_filesystest.obj : .AUTODEPEND .\filesys\filesystest.cpp +$(OBJS)\test_filenametest.obj : .AUTODEPEND .\filename\filenametest.cpp $(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $< -$(OBJS)\test_filetype.obj : .AUTODEPEND .\filetype\filetype.cpp +$(OBJS)\test_filesystest.obj : .AUTODEPEND .\filesys\filesystest.cpp $(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $< $(OBJS)\test_fontmaptest.obj : .AUTODEPEND .\fontmap\fontmaptest.cpp diff --git a/tests/test.bkl b/tests/test.bkl index 81084fec2c..16bb6666af 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -29,9 +29,9 @@ arrays/arrays.cpp datetime/datetimetest.cpp fileconf/fileconftest.cpp + filekind/filekind.cpp filename/filenametest.cpp filesys/filesystest.cpp - filetype/filetype.cpp fontmap/fontmaptest.cpp formatconverter/formatconvertertest.cpp hashes/hashes.cpp diff --git a/tests/test_test.dsp b/tests/test_test.dsp index f82da313ff..8d2a6df7d8 100644 --- a/tests/test_test.dsp +++ b/tests/test_test.dsp @@ -473,19 +473,19 @@ SOURCE=.\fileconf\fileconftest.cpp # End Source File # Begin Source File -SOURCE=.\filename\filenametest.cpp +SOURCE=.\filekind\filekind.cpp # End Source File # Begin Source File -SOURCE=.\streams\filestream.cpp +SOURCE=.\filename\filenametest.cpp # End Source File # Begin Source File -SOURCE=.\filesys\filesystest.cpp +SOURCE=.\streams\filestream.cpp # End Source File # Begin Source File -SOURCE=.\filetype\filetype.cpp +SOURCE=.\filesys\filesystest.cpp # End Source File # Begin Source File