Merge in from trunk r68684 - r69046

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@69047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-09-10 15:09:22 +00:00
283 changed files with 12986 additions and 1945 deletions

View File

@@ -199,6 +199,7 @@ TEST_GUI_OBJECTS = \
test_gui_toolbooktest.o \
test_gui_treebooktest.o \
test_gui_treectrltest.o \
test_gui_treelistctrltest.o \
test_gui_virtlistctrltest.o \
test_gui_webtest.o \
test_gui_windowtest.o \
@@ -342,7 +343,7 @@ COND_wxUSE_REGEX_builtin___LIB_REGEX_p = \
### Targets: ###
all: test$(EXEEXT) $(__test_gui___depname) $(__test_gui_bundle___depname) data fr
all: test$(EXEEXT) $(__test_gui___depname) $(__test_gui_bundle___depname) data data-images fr
install:
@@ -410,6 +411,18 @@ data:
esac; \
done
data-images:
@mkdir -p image
@for f in horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp; do \
if test ! -f image/$$f -a ! -d image/$$f ; \
then x=yep ; \
else x=`find $(srcdir)/image/$$f -newer image/$$f -print` ; \
fi; \
case "$$x" in ?*) \
cp -pRf $(srcdir)/image/$$f image ;; \
esac; \
done
fr:
@mkdir -p ./intl/fr
@for f in internat.po internat.mo; do \
@@ -836,6 +849,9 @@ test_gui_treebooktest.o: $(srcdir)/controls/treebooktest.cpp $(TEST_GUI_ODEP)
test_gui_treectrltest.o: $(srcdir)/controls/treectrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/treectrltest.cpp
test_gui_treelistctrltest.o: $(srcdir)/controls/treelistctrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/treelistctrltest.cpp
test_gui_virtlistctrltest.o: $(srcdir)/controls/virtlistctrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/virtlistctrltest.cpp
@@ -917,7 +933,17 @@ test_gui_xrctest.o: $(srcdir)/xml/xrctest.cpp $(TEST_GUI_ODEP)
# warnings don't matter when we expect compilation to fail anyhow so we can
# use this variable to enable the compilation of code which is supposed to
# fail
failtest:
failtest: failtest_combobox failtest_evthandler
failtest_combobox:
@$(RM) test_gui_comboboxtest.o
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_COMBOBOX_ISEMPTY test_gui_comboboxtest.o 2>/dev/null; then \
echo "*** Compilation with TEST_INVALID_COMBOBOX_ISEMPTY unexpectedly succeeded.">&2; \
exit 1; \
fi; \
exit 0
failtest_evthandler:
@$(RM) test_evthandler.o
@for d in GLOBAL STATIC METHOD FUNCTOR NO_HANDLER DERIVED WRONG_CLASS; do \
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_BIND_$$d test_evthandler.o 2>/dev/null; then \
@@ -932,4 +958,4 @@ failtest:
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean test_gui_bundle data fr
.PHONY: all install uninstall clean distclean test_gui_bundle data data-images fr

View File

@@ -62,12 +62,14 @@ private:
CPPUNIT_TEST( PopDismiss );
CPPUNIT_TEST( Sort );
CPPUNIT_TEST( ReadOnly );
CPPUNIT_TEST( IsEmpty );
CPPUNIT_TEST_SUITE_END();
void Size();
void PopDismiss();
void Sort();
void ReadOnly();
void IsEmpty();
wxComboBox *m_combo;
@@ -194,4 +196,27 @@ void ComboBoxTestCase::ReadOnly()
#endif
}
void ComboBoxTestCase::IsEmpty()
{
CPPUNIT_ASSERT( m_combo->IsListEmpty() );
CPPUNIT_ASSERT( m_combo->IsTextEmpty() );
m_combo->Append("foo");
CPPUNIT_ASSERT( !m_combo->IsListEmpty() );
CPPUNIT_ASSERT( m_combo->IsTextEmpty() );
m_combo->SetValue("bar");
CPPUNIT_ASSERT( !m_combo->IsListEmpty() );
CPPUNIT_ASSERT( !m_combo->IsTextEmpty() );
m_combo->Clear();
CPPUNIT_ASSERT( m_combo->IsListEmpty() );
CPPUNIT_ASSERT( m_combo->IsTextEmpty() );
#ifdef TEST_INVALID_COMBOBOX_ISEMPTY
// Compiling this should fail, see failtest target definition in test.bkl.
m_combo->IsEmpty();
#endif
}
#endif //wxUSE_COMBOBOX

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/controls/treectrltest.cpp
// Name: tests/controls/dataviewctrltest.cpp
// Purpose: wxDataViewCtrl unit test
// Author: Vaclav Slavik
// Created: 2011-08-08
@@ -40,10 +40,19 @@ private:
CPPUNIT_TEST_SUITE( DataViewCtrlTestCase );
CPPUNIT_TEST( DeleteSelected );
CPPUNIT_TEST( DeleteNotSelected );
CPPUNIT_TEST( GetSelectionForMulti );
CPPUNIT_TEST( GetSelectionForSingle );
CPPUNIT_TEST_SUITE_END();
// Create wxDataViewTreeCtrl with the given style.
void Create(long style);
void DeleteSelected();
void DeleteNotSelected();
void GetSelectionForMulti();
void GetSelectionForSingle();
void TestSelectionFor0and1();
// the dataview control itself
wxDataViewTreeCtrl *m_dvc;
@@ -67,13 +76,13 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DataViewCtrlTestCase, "DataViewCtrlTestCa
// test initialization
// ----------------------------------------------------------------------------
void DataViewCtrlTestCase::setUp()
void DataViewCtrlTestCase::Create(long style)
{
m_dvc = new wxDataViewTreeCtrl(wxTheApp->GetTopWindow(),
wxID_ANY,
wxDefaultPosition,
wxSize(400, 200),
wxDV_MULTIPLE);
style);
m_root = m_dvc->AppendContainer(wxDataViewItem(), "The root");
m_child1 = m_dvc->AppendContainer(m_root, "child1");
@@ -86,6 +95,11 @@ void DataViewCtrlTestCase::setUp()
m_dvc->Update();
}
void DataViewCtrlTestCase::setUp()
{
Create(wxDV_MULTIPLE);
}
void DataViewCtrlTestCase::tearDown()
{
delete m_dvc;
@@ -115,7 +129,7 @@ void DataViewCtrlTestCase::DeleteSelected()
m_dvc->GetSelections(sel);
// m_child1 and its children should be removed from the selection now
CPPUNIT_ASSERT( sel.size() == 1 );
CPPUNIT_ASSERT_EQUAL( 1, sel.size() );
CPPUNIT_ASSERT( sel[0] == m_child2 );
}
@@ -131,10 +145,55 @@ void DataViewCtrlTestCase::DeleteNotSelected()
m_dvc->GetSelections(sel);
// m_child1 and its children should be removed from the selection now
CPPUNIT_ASSERT( sel.size() == 2 );
// m_child1 and its children should be unaffected
CPPUNIT_ASSERT_EQUAL( 2, sel.size() );
CPPUNIT_ASSERT( sel[0] == m_child1 );
CPPUNIT_ASSERT( sel[1] == m_grandchild );
}
#endif //wxUSE_TREECTRL
void DataViewCtrlTestCase::TestSelectionFor0and1()
{
wxDataViewItemArray selections;
// Initially there is no selection.
CPPUNIT_ASSERT_EQUAL( 0, m_dvc->GetSelectedItemsCount() );
CPPUNIT_ASSERT( !m_dvc->HasSelection() );
CPPUNIT_ASSERT( !m_dvc->GetSelection().IsOk() );
CPPUNIT_ASSERT( !m_dvc->GetSelections(selections) );
CPPUNIT_ASSERT( selections.empty() );
// Select one item.
m_dvc->Select(m_child1);
CPPUNIT_ASSERT_EQUAL( 1, m_dvc->GetSelectedItemsCount() );
CPPUNIT_ASSERT( m_dvc->HasSelection() );
CPPUNIT_ASSERT( m_dvc->GetSelection().IsOk() );
CPPUNIT_ASSERT_EQUAL( 1, m_dvc->GetSelections(selections) );
CPPUNIT_ASSERT( selections[0] == m_child1 );
}
void DataViewCtrlTestCase::GetSelectionForMulti()
{
wxDataViewItemArray selections;
TestSelectionFor0and1();
// Also test with more than one selected item.
m_dvc->Select(m_child2);
CPPUNIT_ASSERT_EQUAL( 2, m_dvc->GetSelectedItemsCount() );
CPPUNIT_ASSERT( m_dvc->HasSelection() );
CPPUNIT_ASSERT( !m_dvc->GetSelection().IsOk() );
CPPUNIT_ASSERT_EQUAL( 2, m_dvc->GetSelections(selections) );
CPPUNIT_ASSERT( selections[1] == m_child2 );
}
void DataViewCtrlTestCase::GetSelectionForSingle()
{
delete m_dvc;
Create(0);
TestSelectionFor0and1();
}
#endif //wxUSE_DATAVIEWCTRL

View File

@@ -0,0 +1,235 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/controls/treelistctrltest.cpp
// Purpose: wxTreeListCtrl unit test.
// Author: Vadim Zeitlin
// Created: 2011-08-27
// RCS-ID: $Id$
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#if wxUSE_TREELISTCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/treelist.h"
#include "wx/app.h"
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
class TreeListCtrlTestCase : public CppUnit::TestCase
{
public:
TreeListCtrlTestCase() { }
virtual void setUp();
virtual void tearDown();
private:
CPPUNIT_TEST_SUITE( TreeListCtrlTestCase );
CPPUNIT_TEST( Traversal );
CPPUNIT_TEST( ItemText );
CPPUNIT_TEST( ItemCheck );
CPPUNIT_TEST_SUITE_END();
// Create the control with the given style.
void Create(long style);
// Add an item to the tree and increment m_numItems.
wxTreeListItem AddItem(const char *label,
wxTreeListItem parent = wxTreeListItem(),
const char *numFiles = "",
const char *size = "");
// Tests:
void Traversal();
void ItemText();
void ItemCheck();
// The control itself.
wxTreeListCtrl *m_treelist;
// And some of its items.
wxTreeListItem m_code,
m_code_osx,
m_code_osx_cocoa;
// Also the total number of items in it initially
unsigned m_numItems;
wxDECLARE_NO_COPY_CLASS(TreeListCtrlTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( TreeListCtrlTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TreeListCtrlTestCase, "TreeListCtrlTestCase" );
// ----------------------------------------------------------------------------
// test initialization
// ----------------------------------------------------------------------------
wxTreeListItem
TreeListCtrlTestCase::AddItem(const char *label,
wxTreeListItem parent,
const char *numFiles,
const char *size)
{
if ( !parent.IsOk() )
parent = m_treelist->GetRootItem();
wxTreeListItem item = m_treelist->AppendItem(parent, label);
m_treelist->SetItemText(item, 1, numFiles);
m_treelist->SetItemText(item, 2, size);
m_numItems++;
return item;
}
void TreeListCtrlTestCase::Create(long style)
{
m_treelist = new wxTreeListCtrl(wxTheApp->GetTopWindow(),
wxID_ANY,
wxDefaultPosition,
wxSize(400, 200),
style);
m_treelist->AppendColumn("Component");
m_treelist->AppendColumn("# Files");
m_treelist->AppendColumn("Size");
// Fill the control with the same data as used in the treelist sample:
m_code = AddItem("Code");
AddItem("wxMSW", m_code, "313", "3.94 MiB");
AddItem("wxGTK", m_code, "180", "1.66 MiB");
m_code_osx = AddItem("wxOSX", m_code, "265", "2.36 MiB");
AddItem("Core", m_code_osx, "31", "347 KiB");
AddItem("Carbon", m_code_osx, "91", "1.34 MiB");
m_code_osx_cocoa = AddItem("Cocoa", m_code_osx, "46", "512 KiB");
wxTreeListItem Documentation = AddItem("Documentation");
AddItem("HTML", Documentation, "many");
AddItem("CHM", Documentation, "1");
wxTreeListItem Samples = AddItem("Samples");
AddItem("minimal", Samples, "1", "7 KiB");
AddItem("widgets", Samples, "28", "419 KiB");
m_treelist->Refresh();
m_treelist->Update();
}
void TreeListCtrlTestCase::setUp()
{
m_numItems = 0;
Create(wxTL_MULTIPLE | wxTL_3STATE);
}
void TreeListCtrlTestCase::tearDown()
{
delete m_treelist;
m_treelist = NULL;
}
// ----------------------------------------------------------------------------
// the tests themselves
// ----------------------------------------------------------------------------
// Test various tree traversal methods.
void TreeListCtrlTestCase::Traversal()
{
// GetParent() tests:
wxTreeListItem root = m_treelist->GetRootItem();
CPPUNIT_ASSERT( !m_treelist->GetItemParent(root) );
CPPUNIT_ASSERT_EQUAL( root, m_treelist->GetItemParent(m_code) );
CPPUNIT_ASSERT_EQUAL( m_code, m_treelist->GetItemParent(m_code_osx) );
// GetFirstChild() and GetNextSibling() tests:
CPPUNIT_ASSERT_EQUAL( m_code, m_treelist->GetFirstChild(root) );
CPPUNIT_ASSERT_EQUAL
(
m_code_osx,
m_treelist->GetNextSibling
(
m_treelist->GetNextSibling
(
m_treelist->GetFirstChild(m_code)
)
)
);
// Get{First,Next}Item() test:
unsigned numItems = 0;
for ( wxTreeListItem item = m_treelist->GetFirstItem();
item.IsOk();
item = m_treelist->GetNextItem(item) )
{
numItems++;
}
CPPUNIT_ASSERT_EQUAL( m_numItems, numItems );
}
// Test accessing items text.
void TreeListCtrlTestCase::ItemText()
{
CPPUNIT_ASSERT_EQUAL( "Cocoa", m_treelist->GetItemText(m_code_osx_cocoa) );
CPPUNIT_ASSERT_EQUAL( "46", m_treelist->GetItemText(m_code_osx_cocoa, 1) );
m_treelist->SetItemText(m_code_osx_cocoa, "wxCocoa");
CPPUNIT_ASSERT_EQUAL( "wxCocoa", m_treelist->GetItemText(m_code_osx_cocoa) );
m_treelist->SetItemText(m_code_osx_cocoa, 1, "47");
CPPUNIT_ASSERT_EQUAL( "47", m_treelist->GetItemText(m_code_osx_cocoa, 1) );
}
// Test checking and unchecking items.
void TreeListCtrlTestCase::ItemCheck()
{
CPPUNIT_ASSERT_EQUAL( wxCHK_UNCHECKED,
m_treelist->GetCheckedState(m_code) );
m_treelist->CheckItemRecursively(m_code);
CPPUNIT_ASSERT_EQUAL( wxCHK_CHECKED,
m_treelist->GetCheckedState(m_code) );
CPPUNIT_ASSERT_EQUAL( wxCHK_CHECKED,
m_treelist->GetCheckedState(m_code_osx) );
CPPUNIT_ASSERT_EQUAL( wxCHK_CHECKED,
m_treelist->GetCheckedState(m_code_osx_cocoa) );
m_treelist->UncheckItem(m_code_osx_cocoa);
CPPUNIT_ASSERT_EQUAL( wxCHK_UNCHECKED,
m_treelist->GetCheckedState(m_code_osx_cocoa) );
m_treelist->UpdateItemParentStateRecursively(m_code_osx_cocoa);
CPPUNIT_ASSERT_EQUAL( wxCHK_UNDETERMINED,
m_treelist->GetCheckedState(m_code_osx) );
CPPUNIT_ASSERT_EQUAL( wxCHK_UNDETERMINED,
m_treelist->GetCheckedState(m_code) );
m_treelist->CheckItemRecursively(m_code_osx, wxCHK_UNCHECKED);
m_treelist->UpdateItemParentStateRecursively(m_code_osx_cocoa);
CPPUNIT_ASSERT_EQUAL( wxCHK_UNCHECKED,
m_treelist->GetCheckedState(m_code_osx) );
CPPUNIT_ASSERT_EQUAL( wxCHK_UNDETERMINED,
m_treelist->GetCheckedState(m_code) );
}
#endif // wxUSE_TREELISTCTRL

BIN
tests/image/horse_grey.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
tests/image/horse_rle4.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
tests/image/horse_rle8.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -50,7 +50,7 @@ struct testData {
{ "horse.pcx", wxBITMAP_TYPE_PCX, 8 },
{ "horse.pnm", wxBITMAP_TYPE_PNM, 24 },
{ "horse.tga", wxBITMAP_TYPE_TGA, 8 },
{ "horse.tif", wxBITMAP_TYPE_TIF, 8 }
{ "horse.tif", wxBITMAP_TYPE_TIFF, 8 }
};
@@ -73,10 +73,12 @@ private:
CPPUNIT_TEST( CompareLoadedImage );
CPPUNIT_TEST( CompareSavedImage );
CPPUNIT_TEST( SavePNG );
CPPUNIT_TEST( SaveTIFF );
CPPUNIT_TEST( SaveAnimatedGIF );
CPPUNIT_TEST( ReadCorruptedTGA );
CPPUNIT_TEST( GIFComment );
CPPUNIT_TEST( DibPadding );
CPPUNIT_TEST( BMPFlippingAndRLECompression );
CPPUNIT_TEST_SUITE_END();
void LoadFromSocketStream();
@@ -86,10 +88,12 @@ private:
void CompareLoadedImage();
void CompareSavedImage();
void SavePNG();
void SaveTIFF();
void SaveAnimatedGIF();
void ReadCorruptedTGA();
void GIFComment();
void DibPadding();
void BMPFlippingAndRLECompression();
DECLARE_NO_COPY_CLASS(ImageTestCase)
};
@@ -188,7 +192,7 @@ void ImageTestCase::LoadFromZipStream()
case wxBITMAP_TYPE_GIF:
case wxBITMAP_TYPE_PCX:
case wxBITMAP_TYPE_TGA:
case wxBITMAP_TYPE_TIF:
case wxBITMAP_TYPE_TIFF:
continue; // skip testing those wxImageHandlers which cannot
// load data from non-seekable streams
@@ -904,21 +908,15 @@ void CompareImage(const wxImageHandler& handler, const wxImage& image,
const bool testAlpha = (properties & wxIMAGE_HAVE_ALPHA) != 0;
if (testAlpha
&& !(type == wxBITMAP_TYPE_PNG || type == wxBITMAP_TYPE_TGA) )
&& !(type == wxBITMAP_TYPE_PNG || type == wxBITMAP_TYPE_TGA
|| type == wxBITMAP_TYPE_TIFF) )
{
// don't test images with alpha if this handler doesn't support alpha
return;
}
if (type == wxBITMAP_TYPE_JPEG /* skip lossy JPEG */
|| type == wxBITMAP_TYPE_TIF)
if (type == wxBITMAP_TYPE_JPEG /* skip lossy JPEG */)
{
/*
TIFF is skipped because the memory stream can't be loaded. Libtiff
looks for a TIFF directory at offset 120008 while the memory
stream size is only 120008 bytes (when saving as a file
the file size is 120280 bytes).
*/
return;
}
@@ -968,12 +966,28 @@ void CompareImage(const wxImageHandler& handler, const wxImage& image,
);
}
static void SetAlpha(wxImage *image)
{
image->SetAlpha();
unsigned char *ptr = image->GetAlpha();
const int width = image->GetWidth();
const int height = image->GetHeight();
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
ptr[y*width + x] = (x*y) & wxIMAGE_ALPHA_OPAQUE;
}
}
}
void ImageTestCase::CompareSavedImage()
{
// FIXME-VC6: Pre-declare the loop variables for compatibility with
// pre-standard compilers such as MSVC6 that don't implement proper scope
// for the variables declared in the for loops.
int i, x, y;
int i;
wxImage expected24("horse.png");
CPPUNIT_ASSERT( expected24.IsOk() );
@@ -995,17 +1009,8 @@ void ImageTestCase::CompareSavedImage()
// Create an image with alpha based on the loaded image
wxImage expected32(expected24);
expected32.SetAlpha();
int width = expected32.GetWidth();
int height = expected32.GetHeight();
for (y = 0; y < height; ++y)
{
for (x = 0; x < width; ++x)
{
expected32.SetAlpha(x, y, (x*y) & wxIMAGE_ALPHA_OPAQUE);
}
}
SetAlpha(&expected32);
const wxList& list = wxImage::GetHandlers();
for ( wxList::compatibility_iterator node = list.GetFirst();
@@ -1093,6 +1098,62 @@ void ImageTestCase::SavePNG()
}
static void TestTIFFImage(const wxString& option, int value,
const wxImage *compareImage = NULL)
{
wxImage image;
if (compareImage)
{
image = *compareImage;
}
else
{
(void) image.LoadFile("horse.png");
}
CPPUNIT_ASSERT( image.IsOk() );
wxMemoryOutputStream memOut;
image.SetOption(option, value);
CPPUNIT_ASSERT(image.SaveFile(memOut, wxBITMAP_TYPE_TIFF));
wxMemoryInputStream memIn(memOut);
CPPUNIT_ASSERT(memIn.IsOk());
wxImage savedImage(memIn);
CPPUNIT_ASSERT(savedImage.IsOk());
WX_ASSERT_EQUAL_MESSAGE(("While checking for option %s", option),
true, savedImage.HasOption(option));
WX_ASSERT_EQUAL_MESSAGE(("While testing for %s", option),
value, savedImage.GetOptionInt(option));
WX_ASSERT_EQUAL_MESSAGE(("HasAlpha() not equal"), image.HasAlpha(), savedImage.HasAlpha());
}
void ImageTestCase::SaveTIFF()
{
TestTIFFImage(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, 1);
TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 1);
TestTIFFImage(wxIMAGE_OPTION_TIFF_PHOTOMETRIC, 0/*PHOTOMETRIC_MINISWHITE*/);
TestTIFFImage(wxIMAGE_OPTION_TIFF_PHOTOMETRIC, 1/*PHOTOMETRIC_MINISBLACK*/);
wxImage alphaImage("horse.png");
CPPUNIT_ASSERT( alphaImage.IsOk() );
SetAlpha(&alphaImage);
// RGB with alpha
TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 4, &alphaImage);
// Grey with alpha
TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 2, &alphaImage);
// B/W with alpha
alphaImage.SetOption(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, 1);
TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 2, &alphaImage);
}
void ImageTestCase::SaveAnimatedGIF()
{
#if wxUSE_PALETTE
@@ -1262,6 +1323,26 @@ void ImageTestCase::DibPadding()
CPPUNIT_ASSERT( image.SaveFile(memOut, wxBITMAP_TYPE_ICO) );
}
static void CompareBMPImage(const wxString& file1, const wxString& file2)
{
wxImage image1(file1);
CPPUNIT_ASSERT( image1.IsOk() );
wxImage image2(file2);
CPPUNIT_ASSERT( image2.IsOk() );
CompareImage(*wxImage::FindHandler(wxBITMAP_TYPE_BMP), image1, 0, &image2);
}
void ImageTestCase::BMPFlippingAndRLECompression()
{
CompareBMPImage("image/horse_grey.bmp", "image/horse_grey_flipped.bmp");
CompareBMPImage("image/horse_rle8.bmp", "image/horse_grey.bmp");
CompareBMPImage("image/horse_rle8.bmp", "image/horse_rle8_flipped.bmp");
CompareBMPImage("image/horse_rle4.bmp", "image/horse_rle4_flipped.bmp");
}
#endif //wxUSE_IMAGE

View File

@@ -184,6 +184,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_toolbooktest.obj \
$(OBJS)\test_gui_treebooktest.obj \
$(OBJS)\test_gui_treectrltest.obj \
$(OBJS)\test_gui_treelistctrltest.obj \
$(OBJS)\test_gui_virtlistctrltest.obj \
$(OBJS)\test_gui_webtest.obj \
$(OBJS)\test_gui_windowtest.obj \
@@ -426,7 +427,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\test.exe $(__test_gui___depname) data fr
all: $(OBJS)\test.exe $(__test_gui___depname) data data-images fr
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@@ -461,6 +462,10 @@ data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (horse.ani horse.bmp horse.cur horse.gif horse.ico horse.jpg horse.pcx horse.png horse.pnm horse.tga horse.tif horse.xpm) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
data-images:
if not exist image mkdir image
for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%f copy .\image\%f image
fr:
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
for %f in (internat.po internat.mo) do if not exist $(OBJS)\intl\fr\%f copy .\intl\fr\%f $(OBJS)\intl\fr
@@ -885,6 +890,9 @@ $(OBJS)\test_gui_treebooktest.obj: .\controls\treebooktest.cpp
$(OBJS)\test_gui_treectrltest.obj: .\controls\treectrltest.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\treectrltest.cpp
$(OBJS)\test_gui_treelistctrltest.obj: .\controls\treelistctrltest.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\treelistctrltest.cpp
$(OBJS)\test_gui_virtlistctrltest.obj: .\controls\virtlistctrltest.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\virtlistctrltest.cpp

View File

@@ -177,6 +177,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_toolbooktest.o \
$(OBJS)\test_gui_treebooktest.o \
$(OBJS)\test_gui_treectrltest.o \
$(OBJS)\test_gui_treelistctrltest.o \
$(OBJS)\test_gui_virtlistctrltest.o \
$(OBJS)\test_gui_webtest.o \
$(OBJS)\test_gui_windowtest.o \
@@ -422,7 +423,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\test.exe $(__test_gui___depname) data fr
all: $(OBJS)\test.exe $(__test_gui___depname) data data-images fr
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
@@ -442,6 +443,10 @@ data:
if not exist $(OBJS) mkdir $(OBJS)
for %%f in (horse.ani horse.bmp horse.cur horse.gif horse.ico horse.jpg horse.pcx horse.png horse.pnm horse.tga horse.tif horse.xpm) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
data-images:
if not exist image mkdir image
for %%f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%%f copy .\image\%%f image
fr:
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
for %%f in (internat.po internat.mo) do if not exist $(OBJS)\intl\fr\%%f copy .\intl\fr\%%f $(OBJS)\intl\fr
@@ -866,6 +871,9 @@ $(OBJS)\test_gui_treebooktest.o: ./controls/treebooktest.cpp
$(OBJS)\test_gui_treectrltest.o: ./controls/treectrltest.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_treelistctrltest.o: ./controls/treelistctrltest.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_virtlistctrltest.o: ./controls/virtlistctrltest.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
@@ -941,7 +949,7 @@ $(OBJS)\test_gui_setsize.o: ./window/setsize.cpp
$(OBJS)\test_gui_xrctest.o: ./xml/xrctest.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all clean data fr
.PHONY: all clean data data-images fr
SHELL := $(COMSPEC)

View File

@@ -179,6 +179,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_toolbooktest.obj \
$(OBJS)\test_gui_treebooktest.obj \
$(OBJS)\test_gui_treectrltest.obj \
$(OBJS)\test_gui_treelistctrltest.obj \
$(OBJS)\test_gui_virtlistctrltest.obj \
$(OBJS)\test_gui_webtest.obj \
$(OBJS)\test_gui_windowtest.obj \
@@ -558,7 +559,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\test.exe $(__test_gui___depname) data fr
all: $(OBJS)\test.exe $(__test_gui___depname) data data-images fr
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@@ -587,6 +588,10 @@ data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (horse.ani horse.bmp horse.cur horse.gif horse.ico horse.jpg horse.pcx horse.png horse.pnm horse.tga horse.tif horse.xpm) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
data-images:
if not exist image mkdir image
for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%f copy .\image\%f image
fr:
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
for %f in (internat.po internat.mo) do if not exist $(OBJS)\intl\fr\%f copy .\intl\fr\%f $(OBJS)\intl\fr
@@ -1011,6 +1016,9 @@ $(OBJS)\test_gui_treebooktest.obj: .\controls\treebooktest.cpp
$(OBJS)\test_gui_treectrltest.obj: .\controls\treectrltest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\treectrltest.cpp
$(OBJS)\test_gui_treelistctrltest.obj: .\controls\treelistctrltest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\treelistctrltest.cpp
$(OBJS)\test_gui_virtlistctrltest.obj: .\controls\virtlistctrltest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\virtlistctrltest.cpp

View File

@@ -428,6 +428,7 @@ TEST_GUI_OBJECTS = &
$(OBJS)\test_gui_toolbooktest.obj &
$(OBJS)\test_gui_treebooktest.obj &
$(OBJS)\test_gui_treectrltest.obj &
$(OBJS)\test_gui_treelistctrltest.obj &
$(OBJS)\test_gui_virtlistctrltest.obj &
$(OBJS)\test_gui_webtest.obj &
$(OBJS)\test_gui_windowtest.obj &
@@ -461,7 +462,7 @@ $(OBJS) :
### Targets: ###
all : .SYMBOLIC $(OBJS)\test.exe $(__test_gui___depname) data fr
all : .SYMBOLIC $(OBJS)\test.exe $(__test_gui___depname) data data-images fr
clean : .SYMBOLIC
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@@ -502,6 +503,10 @@ data : .SYMBOLIC
if not exist $(OBJS) mkdir $(OBJS)
for %f in (horse.ani horse.bmp horse.cur horse.gif horse.ico horse.jpg horse.pcx horse.png horse.pnm horse.tga horse.tif horse.xpm) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
data-images : .SYMBOLIC
if not exist image mkdir image
for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%f copy .\image\%f image
fr : .SYMBOLIC
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
for %f in (internat.po internat.mo) do if not exist $(OBJS)\intl\fr\%f copy .\intl\fr\%f $(OBJS)\intl\fr
@@ -926,6 +931,9 @@ $(OBJS)\test_gui_treebooktest.obj : .AUTODEPEND .\controls\treebooktest.cpp
$(OBJS)\test_gui_treectrltest.obj : .AUTODEPEND .\controls\treectrltest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
$(OBJS)\test_gui_treelistctrltest.obj : .AUTODEPEND .\controls\treelistctrltest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
$(OBJS)\test_gui_virtlistctrltest.obj : .AUTODEPEND .\controls\virtlistctrltest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<

View File

@@ -180,6 +180,7 @@
controls/toolbooktest.cpp
controls/treebooktest.cpp
controls/treectrltest.cpp
controls/treelistctrltest.cpp
controls/virtlistctrltest.cpp
controls/webtest.cpp
controls/windowtest.cpp
@@ -232,6 +233,14 @@
horse.pcx horse.png horse.pnm horse.tga horse.tif horse.xpm</files>
</wx-data>
<wx-data id="data-images">
<srcdir>$(SRCDIR)/image</srcdir>
<dstdir>image</dstdir>
<files>horse_grey.bmp horse_grey_flipped.bmp
horse_rle4.bmp horse_rle4_flipped.bmp
horse_rle8.bmp horse_rle8_flipped.bmp</files>
</wx-data>
<template id="catalog">
<dstdir>$(BUILDDIR)/intl/$(id)</dstdir>
<srcdir>$(SRCDIR)/intl/$(id)</srcdir>
@@ -247,7 +256,17 @@
# warnings don't matter when we expect compilation to fail anyhow so we can
# use this variable to enable the compilation of code which is supposed to
# fail
failtest:
failtest: failtest_combobox failtest_evthandler
failtest_combobox:
@$(RM) test_gui_comboboxtest.o
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_COMBOBOX_ISEMPTY test_gui_comboboxtest.o 2>/dev/null; then \
echo "*** Compilation with TEST_INVALID_COMBOBOX_ISEMPTY unexpectedly succeeded.">&amp;2; \
exit 1; \
fi; \
exit 0
failtest_evthandler:
@$(RM) test_evthandler.o
@for d in GLOBAL STATIC METHOD FUNCTOR NO_HANDLER DERIVED WRONG_CLASS; do \
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_BIND_$$d test_evthandler.o 2>/dev/null; then \

View File

@@ -537,6 +537,10 @@ SOURCE=.\controls\treectrltest.cpp
# End Source File
# Begin Source File
SOURCE=.\controls\treelistctrltest.cpp
# End Source File
# Begin Source File
SOURCE=.\validators\valnum.cpp
# End Source File
# Begin Source File

View File

@@ -835,6 +835,9 @@
<File
RelativePath=".\controls\treectrltest.cpp">
</File>
<File
RelativePath=".\controls\treelistctrltest.cpp">
</File>
<File
RelativePath=".\validators\valnum.cpp">
</File>

View File

@@ -1187,6 +1187,10 @@
RelativePath=".\controls\treectrltest.cpp"
>
</File>
<File
RelativePath=".\controls\treelistctrltest.cpp"
>
</File>
<File
RelativePath=".\validators\valnum.cpp"
>

View File

@@ -1159,6 +1159,10 @@
RelativePath=".\controls\treectrltest.cpp"
>
</File>
<File
RelativePath=".\controls\treelistctrltest.cpp"
>
</File>
<File
RelativePath=".\validators\valnum.cpp"
>

View File

@@ -31,9 +31,10 @@ struct assertion_traits<wxImage>
static std::string toString(const wxImage& image)
{
return wxString::Format("image of size %d*%d",
return wxString::Format("image of size %d*%d with%s alpha",
image.GetWidth(),
image.GetHeight())
image.GetHeight(),
image.HasAlpha() ? "" : "out")
.ToStdString();
}
};