]> git.saurik.com Git - wxWidgets.git/blame - tests/testimage.h
Use wxFindWindowAtPoint() for hit testing in wxPopupTransientWindow.
[wxWidgets.git] / tests / testimage.h
CommitLineData
a25b5bbf
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/testimage.h
3// Purpose: Unit test helpers for dealing with wxImage.
4// Author: Vadim Zeitlin
a25b5bbf
VZ
5// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
6// Licence: wxWindows licence
7///////////////////////////////////////////////////////////////////////////////
8
9#ifndef _WX_TESTS_TESTIMAGE_H_
10#define _WX_TESTS_TESTIMAGE_H_
11
12#include "wx/image.h"
13
14CPPUNIT_NS_BEGIN
15
16template <>
17struct assertion_traits<wxImage>
18{
19 static bool equal(const wxImage& i1, const wxImage& i2)
20 {
21 if ( i1.GetWidth() != i2.GetWidth() )
22 return false;
23
24 if ( i1.GetHeight() != i2.GetHeight() )
25 return false;
26
27 return memcmp(i1.GetData(), i2.GetData(),
28 i1.GetWidth()*i1.GetHeight()*3) == 0;
29 }
30
31 static std::string toString(const wxImage& image)
32 {
ab176b4b 33 return wxString::Format("image of size %d*%d with%s alpha",
a25b5bbf 34 image.GetWidth(),
ab176b4b
DS
35 image.GetHeight(),
36 image.HasAlpha() ? "" : "out")
a25b5bbf
VZ
37 .ToStdString();
38 }
39};
40
41CPPUNIT_NS_END
42
43#endif // _WX_TESTS_TESTIMAGE_H_