From e1a6bb2944d7422a44e88337f47004412225cb53 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 31 Dec 2022 19:21:33 +0100 Subject: [PATCH] Disable test for loading images using wxURL This requires an image accessible via HTTP (and not HTTPS) but we don't have any such working URLs any longer since the recent change on www.wxwidgets.org. Still make it possible to test this manually by predefining an environment variable containing the URL. (cherry picked from commit 2b5bb6217d9bc9076c283e785f3b8fa43c05e109) --- tests/image/image.cpp | 46 ++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 00ac928a03..56929d3956 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -170,42 +170,26 @@ void ImageTestCase::LoadFromFile() void ImageTestCase::LoadFromSocketStream() { - if (!IsNetworkAvailable()) // implemented in test.cpp - { - WARN("No network connectivity; skipping the " - "ImageTestCase::LoadFromSocketStream test unit."); + // This test doesn't work any more even using the IP address below as the + // HTTP server now redirects everything to HTTPs, so skip it for now unless + // a test URL pointing to a PNG image is defined. + wxString urlStr; + if ( !wxGetEnv("WX_TEST_IMAGE_URL_PNG", &urlStr) ) return; - } - // These URLs use the real IP address of www.wxwidgets.org. - struct { - const char* url; - wxBitmapType type; - } testData[] = - { - { "http://173.254.92.22/assets/img/header-logo.png", wxBITMAP_TYPE_PNG }, - { "http://173.254.92.22/assets/ico/favicon-1.ico", wxBITMAP_TYPE_ICO } - }; + wxURL url(urlStr); + REQUIRE( url.GetError() == wxURL_NOERR ); - for (unsigned int i=0; i in_stream(url.GetInputStream()); + REQUIRE( in_stream ); + REQUIRE( in_stream->IsOk() ); - wxScopedPtr in_stream(url.GetInputStream()); - REQUIRE( in_stream ); - REQUIRE( in_stream->IsOk() ); + wxImage img; - wxImage img; - - // NOTE: it's important to inform wxImage about the type of the image being - // loaded otherwise it will try to autodetect the format, but that - // requires a seekable stream! - CHECK( img.LoadFile(*in_stream, testData[i].type) ); - } - } + // NOTE: it's important to inform wxImage about the type of the image being + // loaded otherwise it will try to autodetect the format, but that + // requires a seekable stream! + CHECK( img.LoadFile(*in_stream, wxBITMAP_TYPE_PNG) ); } void ImageTestCase::LoadFromZipStream()