implemented wxMemoryInputStream::CanRead() and added tests for CanRead() to all stream tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -71,6 +71,7 @@ All:
|
|||||||
- Added wxGridUpdateLocker helper class (Evgeniy Tarassov)
|
- Added wxGridUpdateLocker helper class (Evgeniy Tarassov)
|
||||||
- Support wxGRID_AUTOSIZE in wxGrid::SetRow/ColLabelSize() (Evgeniy Tarassov)
|
- Support wxGRID_AUTOSIZE in wxGrid::SetRow/ColLabelSize() (Evgeniy Tarassov)
|
||||||
- Added wxMemoryInputStream(wxInputStream&) ctor (Stas Sergeev)
|
- Added wxMemoryInputStream(wxInputStream&) ctor (Stas Sergeev)
|
||||||
|
- Implemented wxMemoryInputStream::CanRead()
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -39,7 +39,8 @@ public:
|
|||||||
virtual wxFileOffset GetLength() const { return m_length; }
|
virtual wxFileOffset GetLength() const { return m_length; }
|
||||||
virtual bool IsSeekable() const { return true; }
|
virtual bool IsSeekable() const { return true; }
|
||||||
|
|
||||||
char Peek();
|
virtual char Peek();
|
||||||
|
virtual bool CanRead() const;
|
||||||
|
|
||||||
wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
|
wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
|
||||||
|
|
||||||
|
@@ -97,6 +97,11 @@ wxMemoryInputStream::InitFromStream(wxInputStream& stream, wxFileOffset lenFile)
|
|||||||
m_length = stream.LastRead();
|
m_length = stream.LastRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxMemoryInputStream::CanRead() const
|
||||||
|
{
|
||||||
|
return m_i_streambuf->GetIntPosition() != m_length;
|
||||||
|
}
|
||||||
|
|
||||||
wxMemoryInputStream::~wxMemoryInputStream()
|
wxMemoryInputStream::~wxMemoryInputStream()
|
||||||
{
|
{
|
||||||
delete m_i_streambuf;
|
delete m_i_streambuf;
|
||||||
|
@@ -175,6 +175,19 @@ protected:
|
|||||||
CPPUNIT_ASSERT(stream_in.LastRead() == 1);
|
CPPUNIT_ASSERT(stream_in.LastRead() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Input_CanRead()
|
||||||
|
{
|
||||||
|
CleanupHelper cleanup(this);
|
||||||
|
TStreamIn &stream_in = CreateInStream();
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT( stream_in.CanRead() );
|
||||||
|
|
||||||
|
// read the entire contents
|
||||||
|
(void)stream_in.Read(CreateOutStream());
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT( !stream_in.CanRead() );
|
||||||
|
}
|
||||||
|
|
||||||
// Just try to perform a SeekI() on the input stream.
|
// Just try to perform a SeekI() on the input stream.
|
||||||
void Input_SeekI()
|
void Input_SeekI()
|
||||||
{
|
{
|
||||||
|
@@ -47,6 +47,7 @@ public:
|
|||||||
CPPUNIT_TEST(Input_Read);
|
CPPUNIT_TEST(Input_Read);
|
||||||
CPPUNIT_TEST(Input_Eof);
|
CPPUNIT_TEST(Input_Eof);
|
||||||
CPPUNIT_TEST(Input_LastRead);
|
CPPUNIT_TEST(Input_LastRead);
|
||||||
|
CPPUNIT_TEST(Input_CanRead);
|
||||||
CPPUNIT_TEST(Input_SeekI);
|
CPPUNIT_TEST(Input_SeekI);
|
||||||
CPPUNIT_TEST(Input_TellI);
|
CPPUNIT_TEST(Input_TellI);
|
||||||
CPPUNIT_TEST(Input_Peek);
|
CPPUNIT_TEST(Input_Peek);
|
||||||
|
@@ -47,6 +47,7 @@ public:
|
|||||||
CPPUNIT_TEST(Input_Read);
|
CPPUNIT_TEST(Input_Read);
|
||||||
CPPUNIT_TEST(Input_Eof);
|
CPPUNIT_TEST(Input_Eof);
|
||||||
CPPUNIT_TEST(Input_LastRead);
|
CPPUNIT_TEST(Input_LastRead);
|
||||||
|
CPPUNIT_TEST(Input_CanRead);
|
||||||
CPPUNIT_TEST(Input_SeekI);
|
CPPUNIT_TEST(Input_SeekI);
|
||||||
CPPUNIT_TEST(Input_TellI);
|
CPPUNIT_TEST(Input_TellI);
|
||||||
CPPUNIT_TEST(Input_Peek);
|
CPPUNIT_TEST(Input_Peek);
|
||||||
|
@@ -44,6 +44,7 @@ public:
|
|||||||
CPPUNIT_TEST(Input_Read);
|
CPPUNIT_TEST(Input_Read);
|
||||||
CPPUNIT_TEST(Input_Eof);
|
CPPUNIT_TEST(Input_Eof);
|
||||||
CPPUNIT_TEST(Input_LastRead);
|
CPPUNIT_TEST(Input_LastRead);
|
||||||
|
CPPUNIT_TEST(Input_CanRead);
|
||||||
CPPUNIT_TEST(Input_SeekI);
|
CPPUNIT_TEST(Input_SeekI);
|
||||||
CPPUNIT_TEST(Input_TellI);
|
CPPUNIT_TEST(Input_TellI);
|
||||||
CPPUNIT_TEST(Input_Peek);
|
CPPUNIT_TEST(Input_Peek);
|
||||||
|
@@ -42,6 +42,7 @@ public:
|
|||||||
CPPUNIT_TEST(Input_Read);
|
CPPUNIT_TEST(Input_Read);
|
||||||
CPPUNIT_TEST(Input_Eof);
|
CPPUNIT_TEST(Input_Eof);
|
||||||
CPPUNIT_TEST(Input_LastRead);
|
CPPUNIT_TEST(Input_LastRead);
|
||||||
|
CPPUNIT_TEST(Input_CanRead);
|
||||||
CPPUNIT_TEST(Input_SeekI);
|
CPPUNIT_TEST(Input_SeekI);
|
||||||
CPPUNIT_TEST(Input_TellI);
|
CPPUNIT_TEST(Input_TellI);
|
||||||
CPPUNIT_TEST(Input_Peek);
|
CPPUNIT_TEST(Input_Peek);
|
||||||
|
@@ -55,6 +55,7 @@ public:
|
|||||||
CPPUNIT_TEST(Input_Read);
|
CPPUNIT_TEST(Input_Read);
|
||||||
CPPUNIT_TEST(Input_Eof);
|
CPPUNIT_TEST(Input_Eof);
|
||||||
CPPUNIT_TEST(Input_LastRead);
|
CPPUNIT_TEST(Input_LastRead);
|
||||||
|
CPPUNIT_TEST(Input_CanRead);
|
||||||
CPPUNIT_TEST_FAIL(Input_SeekI);
|
CPPUNIT_TEST_FAIL(Input_SeekI);
|
||||||
CPPUNIT_TEST(Input_TellI);
|
CPPUNIT_TEST(Input_TellI);
|
||||||
CPPUNIT_TEST(Input_Peek);
|
CPPUNIT_TEST(Input_Peek);
|
||||||
|
Reference in New Issue
Block a user