Add a simple wxBitmapBundle unit test
Check for the minimal functionality when using vector-based implementation.
This commit is contained in:
@@ -183,6 +183,7 @@ TEST_GUI_OBJECTS = \
|
||||
test_gui_point.o \
|
||||
test_gui_region.o \
|
||||
test_gui_bitmap.o \
|
||||
test_gui_bmpbundle.o \
|
||||
test_gui_colour.o \
|
||||
test_gui_ellipsization.o \
|
||||
test_gui_measuring.o \
|
||||
@@ -904,6 +905,9 @@ test_gui_region.o: $(srcdir)/geometry/region.cpp $(TEST_GUI_ODEP)
|
||||
test_gui_bitmap.o: $(srcdir)/graphics/bitmap.cpp $(TEST_GUI_ODEP)
|
||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/bitmap.cpp
|
||||
|
||||
test_gui_bmpbundle.o: $(srcdir)/graphics/bmpbundle.cpp $(TEST_GUI_ODEP)
|
||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/bmpbundle.cpp
|
||||
|
||||
test_gui_colour.o: $(srcdir)/graphics/colour.cpp $(TEST_GUI_ODEP)
|
||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/colour.cpp
|
||||
|
||||
|
48
tests/graphics/bmpbundle.cpp
Normal file
48
tests/graphics/bmpbundle.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tests/graphics/bmpbundle.cpp
|
||||
// Purpose: wxBitmapBundle unit test
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2021-09-27
|
||||
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "testprec.h"
|
||||
|
||||
#include "wx/bmpbndl.h"
|
||||
|
||||
#include "asserthelper.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// tests
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
TEST_CASE("BitmapBundle::Create", "[bmpbundle]")
|
||||
{
|
||||
wxBitmapBundle b;
|
||||
CHECK( !b.IsOk() );
|
||||
CHECK( b.GetDefaultSize() == wxDefaultSize );
|
||||
|
||||
b = wxBitmap(16, 16);
|
||||
CHECK( b.IsOk() );
|
||||
CHECK( b.GetDefaultSize() == wxSize(16, 16) );
|
||||
}
|
||||
|
||||
TEST_CASE("BitmapBundle::FromBitmaps", "[bmpbundle]")
|
||||
{
|
||||
wxVector<wxBitmap> bitmaps;
|
||||
bitmaps.push_back(wxBitmap(16, 16));
|
||||
bitmaps.push_back(wxBitmap(24, 24));
|
||||
|
||||
wxBitmapBundle b = wxBitmapBundle::FromBitmaps(bitmaps);
|
||||
REQUIRE( b.IsOk() );
|
||||
CHECK( b.GetDefaultSize() == wxSize(16, 16) );
|
||||
|
||||
CHECK( b.GetBitmap(wxDefaultSize ).GetSize() == wxSize(16, 16) );
|
||||
CHECK( b.GetBitmap(wxSize(16, 16)).GetSize() == wxSize(16, 16) );
|
||||
CHECK( b.GetBitmap(wxSize(20, 20)).GetSize() == wxSize(20, 20) );
|
||||
CHECK( b.GetBitmap(wxSize(24, 24)).GetSize() == wxSize(24, 24) );
|
||||
}
|
@@ -157,6 +157,7 @@ TEST_GUI_OBJECTS = \
|
||||
$(OBJS)\test_gui_point.o \
|
||||
$(OBJS)\test_gui_region.o \
|
||||
$(OBJS)\test_gui_bitmap.o \
|
||||
$(OBJS)\test_gui_bmpbundle.o \
|
||||
$(OBJS)\test_gui_colour.o \
|
||||
$(OBJS)\test_gui_ellipsization.o \
|
||||
$(OBJS)\test_gui_measuring.o \
|
||||
@@ -879,6 +880,9 @@ $(OBJS)\test_gui_region.o: ./geometry/region.cpp
|
||||
$(OBJS)\test_gui_bitmap.o: ./graphics/bitmap.cpp
|
||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\test_gui_bmpbundle.o: ./graphics/bmpbundle.cpp
|
||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\test_gui_colour.o: ./graphics/colour.cpp
|
||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
@@ -173,6 +173,7 @@ TEST_GUI_OBJECTS = \
|
||||
$(OBJS)\test_gui_point.obj \
|
||||
$(OBJS)\test_gui_region.obj \
|
||||
$(OBJS)\test_gui_bitmap.obj \
|
||||
$(OBJS)\test_gui_bmpbundle.obj \
|
||||
$(OBJS)\test_gui_colour.obj \
|
||||
$(OBJS)\test_gui_ellipsization.obj \
|
||||
$(OBJS)\test_gui_measuring.obj \
|
||||
@@ -1313,6 +1314,9 @@ $(OBJS)\test_gui_region.obj: .\geometry\region.cpp
|
||||
$(OBJS)\test_gui_bitmap.obj: .\graphics\bitmap.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\bitmap.cpp
|
||||
|
||||
$(OBJS)\test_gui_bmpbundle.obj: .\graphics\bmpbundle.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\bmpbundle.cpp
|
||||
|
||||
$(OBJS)\test_gui_colour.obj: .\graphics\colour.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\colour.cpp
|
||||
|
||||
|
@@ -177,6 +177,7 @@
|
||||
geometry/point.cpp
|
||||
geometry/region.cpp
|
||||
graphics/bitmap.cpp
|
||||
graphics/bmpbundle.cpp
|
||||
graphics/colour.cpp
|
||||
graphics/ellipsization.cpp
|
||||
graphics/measuring.cpp
|
||||
|
@@ -545,6 +545,7 @@
|
||||
<ClCompile Include="geometry\size.cpp" />
|
||||
<ClCompile Include="graphics\affinematrix.cpp" />
|
||||
<ClCompile Include="graphics\bitmap.cpp" />
|
||||
<ClCompile Include="graphics\bmpbundle.cpp" />
|
||||
<ClCompile Include="graphics\boundingbox.cpp" />
|
||||
<ClCompile Include="graphics\clippingbox.cpp" />
|
||||
<ClCompile Include="graphics\coords.cpp" />
|
||||
|
@@ -23,6 +23,9 @@
|
||||
<ClCompile Include="graphics\bitmap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="graphics\bmpbundle.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="controls\bitmapcomboboxtest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -320,4 +323,4 @@
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@@ -858,6 +858,10 @@
|
||||
RelativePath=".\controls\bitmaptogglebuttontest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\graphics\bmpbundle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\controls\bookctrlbasetest.cpp"
|
||||
>
|
||||
|
@@ -830,6 +830,10 @@
|
||||
RelativePath=".\controls\bitmaptogglebuttontest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\graphics\bmpbundle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\controls\bookctrlbasetest.cpp"
|
||||
>
|
||||
|
Reference in New Issue
Block a user