Check that we parsed something in wxBitmapBundle::FromSVG()
Don't always return success from this function, NanoSVG just skips everything until the start of the XML prologue and doesn't return an error even if it doesn't find it at all, so check that it could parse at least something to avoid returning a "valid" bundle not containing anything at all. Add a unit test checking that we actually can't create an SVG from a .bmp file (which is something that "worked" before).
This commit is contained in:
@@ -140,9 +140,13 @@ TEST_CASE("BitmapBundle::FromSVG", "[bmpbundle][svg]")
|
||||
|
||||
TEST_CASE("BitmapBundle::FromSVGFile", "[bmpbundle][svg][file]")
|
||||
{
|
||||
wxBitmapBundle b = wxBitmapBundle::FromSVGFile("horse.svg", wxSize(20, 20));
|
||||
const wxSize size(20, 20); // completely arbitrary
|
||||
|
||||
CHECK( !wxBitmapBundle::FromSVGFile("horse.bmp", size).IsOk() );
|
||||
|
||||
wxBitmapBundle b = wxBitmapBundle::FromSVGFile("horse.svg", size);
|
||||
REQUIRE( b.IsOk() );
|
||||
CHECK( b.GetDefaultSize() == wxSize(20, 20) );
|
||||
CHECK( b.GetDefaultSize() == size );
|
||||
}
|
||||
|
||||
#endif // wxHAS_SVG
|
||||
|
||||
Reference in New Issue
Block a user