Merge branch 'ci-url-test'
Try to work around the errors in URL test under AppVeyor. See https://github.com/wxWidgets/wxWidgets/pull/1138
This commit is contained in:
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "wx/url.h"
|
#include "wx/url.h"
|
||||||
#include "wx/mstream.h"
|
#include "wx/mstream.h"
|
||||||
|
#include "wx/scopedptr.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// test class
|
// test class
|
||||||
@@ -73,7 +75,16 @@ void URLTestCase::GetInputStream()
|
|||||||
wxURL url("http://www.wxwidgets.org/assets/img/header-logo.png");
|
wxURL url("http://www.wxwidgets.org/assets/img/header-logo.png");
|
||||||
CPPUNIT_ASSERT_EQUAL(wxURL_NOERR, url.GetError());
|
CPPUNIT_ASSERT_EQUAL(wxURL_NOERR, url.GetError());
|
||||||
|
|
||||||
wxInputStream *in_stream = url.GetInputStream();
|
wxScopedPtr<wxInputStream> in_stream(url.GetInputStream());
|
||||||
|
if ( !in_stream && IsAutomaticTest() )
|
||||||
|
{
|
||||||
|
// Sometimes the connection fails during CI runs, try to connect once
|
||||||
|
// again if this happens in the hope it was just a transient error.
|
||||||
|
wxSleep(3);
|
||||||
|
WARN("Connection to www.wxwidgets.org failed, retrying...");
|
||||||
|
in_stream.reset(url.GetInputStream());
|
||||||
|
}
|
||||||
|
|
||||||
CPPUNIT_ASSERT(in_stream);
|
CPPUNIT_ASSERT(in_stream);
|
||||||
CPPUNIT_ASSERT(in_stream->IsOk());
|
CPPUNIT_ASSERT(in_stream->IsOk());
|
||||||
|
|
||||||
@@ -81,9 +92,6 @@ void URLTestCase::GetInputStream()
|
|||||||
CPPUNIT_ASSERT(in_stream->Read(ostream).GetLastError() == wxSTREAM_EOF);
|
CPPUNIT_ASSERT(in_stream->Read(ostream).GetLastError() == wxSTREAM_EOF);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(17334, ostream.GetSize());
|
CPPUNIT_ASSERT_EQUAL(17334, ostream.GetSize());
|
||||||
|
|
||||||
// we have to delete the object created by GetInputStream()
|
|
||||||
delete in_stream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void URLTestCase::CopyAndAssignment()
|
void URLTestCase::CopyAndAssignment()
|
||||||
|
Reference in New Issue
Block a user