Fix or disable currently failing wxGTK GUI tests
Try to ensure that the GUI test suite passes so that buildbot has a chance to warn us if/when anything breaks.
This commit is contained in:
@@ -171,6 +171,7 @@ wxGTK:
|
|||||||
- Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert).
|
- Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert).
|
||||||
- Make wxBORDER_NONE work for wxTextCtrl with GTK+ 3 (Adrien Tétar).
|
- Make wxBORDER_NONE work for wxTextCtrl with GTK+ 3 (Adrien Tétar).
|
||||||
- Apply wxTextCtrl::SetDefaultStyle() to user-entered text (Andreas Falkenhahn).
|
- Apply wxTextCtrl::SetDefaultStyle() to user-entered text (Andreas Falkenhahn).
|
||||||
|
- Fix wxTextCtrl::GetStyle() with GTK+ 3.
|
||||||
- Support background colour in wxDataViewCtrl attributes.
|
- Support background colour in wxDataViewCtrl attributes.
|
||||||
- Improve wxSpinCtrl best size calculation.
|
- Improve wxSpinCtrl best size calculation.
|
||||||
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
|
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
|
||||||
|
@@ -202,22 +202,24 @@ inline std::string wxGetCurrentTestName()
|
|||||||
public: \
|
public: \
|
||||||
void runTest() wxOVERRIDE \
|
void runTest() wxOVERRIDE \
|
||||||
{ \
|
{ \
|
||||||
struct EatNextSemicolon
|
using namespace wxPrivate; \
|
||||||
|
TempStringAssign setClass(wxTheCurrentTestClass, #testclass)
|
||||||
|
|
||||||
#define CPPUNIT_TEST(testname) \
|
#define CPPUNIT_TEST(testname) \
|
||||||
SECTION(#testname " test") \
|
SECTION(#testname) \
|
||||||
{ \
|
{ \
|
||||||
setUp(); \
|
TempStringAssign setMethod(wxTheCurrentTestMethod, #testname); \
|
||||||
try \
|
setUp(); \
|
||||||
{ \
|
try \
|
||||||
testname(); \
|
{ \
|
||||||
} \
|
testname(); \
|
||||||
catch ( ... ) \
|
} \
|
||||||
{ \
|
catch ( ... ) \
|
||||||
tearDown(); \
|
{ \
|
||||||
throw; \
|
tearDown(); \
|
||||||
} \
|
throw; \
|
||||||
tearDown(); \
|
} \
|
||||||
|
tearDown(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CPPUNIT_TEST_SUITE_END() \
|
#define CPPUNIT_TEST_SUITE_END() \
|
||||||
|
@@ -1033,6 +1033,31 @@ public:
|
|||||||
correspond to the positions in the value string.
|
correspond to the positions in the value string.
|
||||||
|
|
||||||
|
|
||||||
|
@section textctrl_positions_xy wxTextCtrl Positions and Coordinates
|
||||||
|
|
||||||
|
It is possible to use either linear positions, i.e. roughly (but @e not
|
||||||
|
always exactly, as explained in the previous section) the index of the
|
||||||
|
character in the text contained in the control or X-Y coordinates, i.e.
|
||||||
|
column and line of the character when working with this class and it
|
||||||
|
provides the functions PositionToXY() and XYToPosition() to convert between
|
||||||
|
the two.
|
||||||
|
|
||||||
|
Additionally, a position in the control can be converted to its coordinates
|
||||||
|
in pixels using PositionToCoords() which can be useful to e.g. show a popup
|
||||||
|
menu near the given character. And, in the other direction, HitTest() can
|
||||||
|
be used to find the character under, or near, the given pixel coordinates.
|
||||||
|
|
||||||
|
To be more precise, positions actually refer to the gaps between characters
|
||||||
|
and not the characters themselves. Thus, position 0 is the one before the
|
||||||
|
very first character in the control and so is a valid position even when
|
||||||
|
the control is empty. And if the control contains a single character, it
|
||||||
|
has two valid positions: 0 before this character and 1 -- after it. This,
|
||||||
|
when the documentation of various functions mentions "invalid position", it
|
||||||
|
doesn't consider the position just after the last character of the line to
|
||||||
|
be invalid, only the positions beyond that one (e.g. 2 and greater in the
|
||||||
|
single character example) are actually invalid.
|
||||||
|
|
||||||
|
|
||||||
@section textctrl_styles wxTextCtrl Styles.
|
@section textctrl_styles wxTextCtrl Styles.
|
||||||
|
|
||||||
Multi-line text controls support styling, i.e. provide a possibility to set
|
Multi-line text controls support styling, i.e. provide a possibility to set
|
||||||
|
@@ -88,6 +88,7 @@ using namespace std;
|
|||||||
#ifndef __WXGTK3__
|
#ifndef __WXGTK3__
|
||||||
#include "wx/gtk/dc.h"
|
#include "wx/gtk/dc.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "wx/gtk/private/object.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXQT__
|
#ifdef __WXQT__
|
||||||
@@ -2605,7 +2606,7 @@ void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y)
|
|||||||
if ( ((wxCairoFontData*)m_font.GetRefData())->Apply(this) )
|
if ( ((wxCairoFontData*)m_font.GetRefData())->Apply(this) )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
PangoLayout *layout = pango_cairo_create_layout (m_context);
|
wxGtkObject<PangoLayout> layout(pango_cairo_create_layout (m_context));
|
||||||
const wxFont& font = static_cast<wxCairoFontData*>(m_font.GetRefData())->GetFont();
|
const wxFont& font = static_cast<wxCairoFontData*>(m_font.GetRefData())->GetFont();
|
||||||
pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description);
|
pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description);
|
||||||
pango_layout_set_text(layout, data, data.length());
|
pango_layout_set_text(layout, data, data.length());
|
||||||
@@ -2614,8 +2615,6 @@ void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y)
|
|||||||
cairo_move_to(m_context, x, y);
|
cairo_move_to(m_context, x, y);
|
||||||
pango_cairo_show_layout (m_context, layout);
|
pango_cairo_show_layout (m_context, layout);
|
||||||
|
|
||||||
g_object_unref (layout);
|
|
||||||
|
|
||||||
// Don't use Cairo text API, we already did everything.
|
// Don't use Cairo text API, we already did everything.
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@@ -2644,7 +2643,10 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub
|
|||||||
if ( externalLeading )
|
if ( externalLeading )
|
||||||
*externalLeading = 0;
|
*externalLeading = 0;
|
||||||
|
|
||||||
if ( str.empty())
|
// We can skip computing the string width and height if it is empty, but
|
||||||
|
// not its descent and/or external leading, which still needs to be
|
||||||
|
// returned even for an empty string.
|
||||||
|
if ( str.empty() && !descent && !externalLeading )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this) )
|
if ( ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this) )
|
||||||
@@ -2652,7 +2654,7 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub
|
|||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
PangoLayout *layout = pango_cairo_create_layout (m_context);
|
wxGtkObject<PangoLayout> layout(pango_cairo_create_layout (m_context));
|
||||||
const wxFont& font = static_cast<wxCairoFontData*>(m_font.GetRefData())->GetFont();
|
const wxFont& font = static_cast<wxCairoFontData*>(m_font.GetRefData())->GetFont();
|
||||||
pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description);
|
pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description);
|
||||||
const wxCharBuffer data = str.utf8_str();
|
const wxCharBuffer data = str.utf8_str();
|
||||||
@@ -2673,7 +2675,6 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub
|
|||||||
pango_layout_iter_free(iter);
|
pango_layout_iter_free(iter);
|
||||||
*descent = h - PANGO_PIXELS(baseline);
|
*descent = h - PANGO_PIXELS(baseline);
|
||||||
}
|
}
|
||||||
g_object_unref (layout);
|
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -2720,7 +2721,7 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble&
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
if (data.length())
|
if (data.length())
|
||||||
{
|
{
|
||||||
PangoLayout* layout = pango_cairo_create_layout(m_context);
|
wxGtkObject<PangoLayout> layout(pango_cairo_create_layout(m_context));
|
||||||
const wxFont& font = static_cast<wxCairoFontData*>(m_font.GetRefData())->GetFont();
|
const wxFont& font = static_cast<wxCairoFontData*>(m_font.GetRefData())->GetFont();
|
||||||
pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description);
|
pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description);
|
||||||
pango_layout_set_text(layout, data, data.length());
|
pango_layout_set_text(layout, data, data.length());
|
||||||
@@ -2732,7 +2733,6 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble&
|
|||||||
widths.Add(PANGO_PIXELS(w));
|
widths.Add(PANGO_PIXELS(w));
|
||||||
} while (pango_layout_iter_next_cluster(iter));
|
} while (pango_layout_iter_next_cluster(iter));
|
||||||
pango_layout_iter_free(iter);
|
pango_layout_iter_free(iter);
|
||||||
g_object_unref(layout);
|
|
||||||
}
|
}
|
||||||
size_t i = widths.GetCount();
|
size_t i = widths.GetCount();
|
||||||
const size_t len = text.length();
|
const size_t len = text.length();
|
||||||
|
@@ -4097,7 +4097,7 @@ void wxListMainWindow::DeleteItem( long lindex )
|
|||||||
// with many items, the vertical scroll position may change so that the new
|
// with many items, the vertical scroll position may change so that the new
|
||||||
// last item is not visible any longer, which is very annoying from the
|
// last item is not visible any longer, which is very annoying from the
|
||||||
// user point of view. Ensure that whatever happens, this item is visible.
|
// user point of view. Ensure that whatever happens, this item is visible.
|
||||||
if (count > 1)
|
if ( count > 1 && m_current != (size_t)-1 )
|
||||||
EnsureVisible(m_current);
|
EnsureVisible(m_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -991,9 +991,7 @@ void wxOwnerDrawnComboBox::DoClear()
|
|||||||
|
|
||||||
GetVListBoxComboPopup()->Clear();
|
GetVListBoxComboPopup()->Clear();
|
||||||
|
|
||||||
// NB: This really needs to be SetValue() instead of ChangeValue(),
|
wxTextEntry::Clear();
|
||||||
// as wxTextEntry API expects an event to be sent.
|
|
||||||
SetValue(wxEmptyString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxOwnerDrawnComboBox::Clear()
|
void wxOwnerDrawnComboBox::Clear()
|
||||||
|
@@ -1046,7 +1046,12 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
if ( text.empty() )
|
if ( text.empty() )
|
||||||
|
{
|
||||||
|
// We don't need to actually do anything, but we still need to generate
|
||||||
|
// an event expected from this call.
|
||||||
|
SendTextUpdatedEvent(this);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// we're changing the text programmatically
|
// we're changing the text programmatically
|
||||||
DontMarkDirtyOnNextChange();
|
DontMarkDirtyOnNextChange();
|
||||||
@@ -1187,20 +1192,35 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
|
|||||||
{
|
{
|
||||||
if ( IsSingleLine() )
|
if ( IsSingleLine() )
|
||||||
{
|
{
|
||||||
|
if ( y != 0 || x > GTKGetEntryTextLength(GTK_ENTRY(m_text)) )
|
||||||
if ( y != 0 || x >= GTKGetEntryTextLength(GTK_ENTRY(m_text)) )
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gint numLines = gtk_text_buffer_get_line_count (m_buffer);
|
||||||
|
|
||||||
GtkTextIter iter;
|
GtkTextIter iter;
|
||||||
if (y >= gtk_text_buffer_get_line_count (m_buffer))
|
if (y >= numLines)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
gtk_text_buffer_get_iter_at_line(m_buffer, &iter, y);
|
gtk_text_buffer_get_iter_at_line(m_buffer, &iter, y);
|
||||||
if (x >= gtk_text_iter_get_chars_in_line (&iter))
|
|
||||||
|
const gint lineLength = gtk_text_iter_get_chars_in_line (&iter);
|
||||||
|
if (x > lineLength)
|
||||||
|
{
|
||||||
|
// This coordinate is always invalid.
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x == lineLength)
|
||||||
|
{
|
||||||
|
// In this case the coordinate is considered to be valid by wx if this
|
||||||
|
// is the last line, as it corresponds to the last position beyond the
|
||||||
|
// last character of the text, and invalid otherwise.
|
||||||
|
if (y != numLines - 1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return gtk_text_iter_get_offset(&iter) + x;
|
return gtk_text_iter_get_offset(&iter) + x;
|
||||||
}
|
}
|
||||||
@@ -1757,8 +1777,13 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
|
|||||||
}
|
}
|
||||||
else // have custom attributes
|
else // have custom attributes
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK3__
|
||||||
|
style.SetBackgroundColour(*pattr->appearance.rgba[0]);
|
||||||
|
style.SetTextColour(*pattr->appearance.rgba[1]);
|
||||||
|
#else
|
||||||
style.SetBackgroundColour(pattr->appearance.bg_color);
|
style.SetBackgroundColour(pattr->appearance.bg_color);
|
||||||
style.SetTextColour(pattr->appearance.fg_color);
|
style.SetTextColour(pattr->appearance.fg_color);
|
||||||
|
#endif
|
||||||
|
|
||||||
const wxGtkString
|
const wxGtkString
|
||||||
pangoFontString(pango_font_description_to_string(pattr->font));
|
pangoFontString(pango_font_description_to_string(pattr->font));
|
||||||
|
@@ -397,7 +397,7 @@ void TextCtrlTestCase::Style()
|
|||||||
#ifndef __WXOSX__
|
#ifndef __WXOSX__
|
||||||
delete m_text;
|
delete m_text;
|
||||||
// We need wxTE_RICH under windows for style support
|
// We need wxTE_RICH under windows for style support
|
||||||
CreateText(wxTE_RICH);
|
CreateText(wxTE_MULTILINE|wxTE_RICH);
|
||||||
|
|
||||||
// Red text on a white background
|
// Red text on a white background
|
||||||
m_text->SetDefaultStyle(wxTextAttr(*wxRED, *wxWHITE));
|
m_text->SetDefaultStyle(wxTextAttr(*wxRED, *wxWHITE));
|
||||||
@@ -431,20 +431,21 @@ void TextCtrlTestCase::Style()
|
|||||||
wxTextAttr style;
|
wxTextAttr style;
|
||||||
|
|
||||||
// We have to check that styles are supported
|
// We have to check that styles are supported
|
||||||
if(m_text->GetStyle(3, style))
|
if ( !m_text->GetStyle(3, style) )
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT_EQUAL(style.GetTextColour(), *wxRED);
|
WARN("Retrieving text style not supported, skipping test.");
|
||||||
CPPUNIT_ASSERT_EQUAL(style.GetBackgroundColour(), *wxWHITE);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHECK( style.GetTextColour() == *wxRED );
|
||||||
|
CHECK( style.GetBackgroundColour() == *wxWHITE );
|
||||||
|
|
||||||
// And then setting the style
|
// And then setting the style
|
||||||
if(m_text->SetStyle(15, 18, style))
|
REQUIRE( m_text->SetStyle(15, 18, style) );
|
||||||
{
|
|
||||||
m_text->GetStyle(17, style);
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(style.GetTextColour(), *wxRED);
|
REQUIRE( m_text->GetStyle(17, style) );
|
||||||
CPPUNIT_ASSERT_EQUAL(style.GetBackgroundColour(), *wxWHITE);
|
CHECK( style.GetTextColour() == *wxRED );
|
||||||
}
|
CHECK( style.GetBackgroundColour() == *wxWHITE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +604,7 @@ void TextCtrlTestCase::PositionToCoordsRich2()
|
|||||||
void TextCtrlTestCase::DoPositionToCoordsTestWithStyle(long style)
|
void TextCtrlTestCase::DoPositionToCoordsTestWithStyle(long style)
|
||||||
{
|
{
|
||||||
delete m_text;
|
delete m_text;
|
||||||
CreateText(style);
|
CreateText(style|wxTE_MULTILINE);
|
||||||
|
|
||||||
// Asking for invalid index should fail.
|
// Asking for invalid index should fail.
|
||||||
WX_ASSERT_FAILS_WITH_ASSERT( m_text->PositionToCoords(1) );
|
WX_ASSERT_FAILS_WITH_ASSERT( m_text->PositionToCoords(1) );
|
||||||
@@ -667,11 +668,31 @@ void TextCtrlTestCase::DoPositionToCoordsTestWithStyle(long style)
|
|||||||
// last position is in its bounds.
|
// last position is in its bounds.
|
||||||
m_text->SetInsertionPointEnd();
|
m_text->SetInsertionPointEnd();
|
||||||
|
|
||||||
CPPUNIT_ASSERT( m_text->PositionToCoords(0).y < 0 );
|
const int pos = m_text->GetInsertionPoint();
|
||||||
CPPUNIT_ASSERT
|
|
||||||
(
|
// wxGTK needs to yield here to update the text control.
|
||||||
m_text->PositionToCoords(m_text->GetInsertionPoint()).y <= TEXT_HEIGHT
|
#ifdef __WXGTK__
|
||||||
);
|
wxStopWatch sw;
|
||||||
|
while ( m_text->PositionToCoords(0).y == 0 ||
|
||||||
|
m_text->PositionToCoords(pos).y > TEXT_HEIGHT )
|
||||||
|
{
|
||||||
|
if ( sw.Time() > 1000 )
|
||||||
|
{
|
||||||
|
FAIL("Timed out waiting for wxTextCtrl update.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxYield();
|
||||||
|
}
|
||||||
|
#endif // __WXGTK__
|
||||||
|
|
||||||
|
wxPoint coords = m_text->PositionToCoords(0);
|
||||||
|
INFO("First position coords = " << coords);
|
||||||
|
CPPUNIT_ASSERT( coords.y < 0 );
|
||||||
|
|
||||||
|
coords = m_text->PositionToCoords(pos);
|
||||||
|
INFO("Position is " << pos << ", coords = " << coords);
|
||||||
|
CPPUNIT_ASSERT( coords.y <= TEXT_HEIGHT );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextCtrlTestCase::PositionToXYMultiLine()
|
void TextCtrlTestCase::PositionToXYMultiLine()
|
||||||
@@ -935,6 +956,7 @@ void TextCtrlTestCase::DoXYToPositionMultiLine(long style)
|
|||||||
for( long x = 0; x < maxLineLength_0+1; x++ )
|
for( long x = 0; x < maxLineLength_0+1; x++ )
|
||||||
{
|
{
|
||||||
long p = m_text->XYToPosition(x, y);
|
long p = m_text->XYToPosition(x, y);
|
||||||
|
INFO("x=" << x << ", y=" << y);
|
||||||
CPPUNIT_ASSERT_EQUAL( pos_0[y][x], p );
|
CPPUNIT_ASSERT_EQUAL( pos_0[y][x], p );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -951,6 +973,7 @@ void TextCtrlTestCase::DoXYToPositionMultiLine(long style)
|
|||||||
for( long x = 0; x < maxLineLength_1+1; x++ )
|
for( long x = 0; x < maxLineLength_1+1; x++ )
|
||||||
{
|
{
|
||||||
long p = m_text->XYToPosition(x, y);
|
long p = m_text->XYToPosition(x, y);
|
||||||
|
INFO("x=" << x << ", y=" << y);
|
||||||
CPPUNIT_ASSERT_EQUAL( pos_1[y][x], p );
|
CPPUNIT_ASSERT_EQUAL( pos_1[y][x], p );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,6 +1008,7 @@ void TextCtrlTestCase::DoXYToPositionMultiLine(long style)
|
|||||||
for( long x = 0; x < maxLineLength_2+1; x++ )
|
for( long x = 0; x < maxLineLength_2+1; x++ )
|
||||||
{
|
{
|
||||||
long p = m_text->XYToPosition(x, y);
|
long p = m_text->XYToPosition(x, y);
|
||||||
|
INFO("x=" << x << ", y=" << y);
|
||||||
CPPUNIT_ASSERT_EQUAL( ref_pos_2[y][x], p );
|
CPPUNIT_ASSERT_EQUAL( ref_pos_2[y][x], p );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1021,6 +1045,7 @@ void TextCtrlTestCase::DoXYToPositionMultiLine(long style)
|
|||||||
for( long x = 0; x < maxLineLength_3+1; x++ )
|
for( long x = 0; x < maxLineLength_3+1; x++ )
|
||||||
{
|
{
|
||||||
long p = m_text->XYToPosition(x, y);
|
long p = m_text->XYToPosition(x, y);
|
||||||
|
INFO("x=" << x << ", y=" << y);
|
||||||
CPPUNIT_ASSERT_EQUAL( ref_pos_3[y][x], p );
|
CPPUNIT_ASSERT_EQUAL( ref_pos_3[y][x], p );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1061,6 +1086,7 @@ void TextCtrlTestCase::DoXYToPositionMultiLine(long style)
|
|||||||
for( long x = 0; x < maxLineLength_4+1; x++ )
|
for( long x = 0; x < maxLineLength_4+1; x++ )
|
||||||
{
|
{
|
||||||
long p = m_text->XYToPosition(x, y);
|
long p = m_text->XYToPosition(x, y);
|
||||||
|
INFO("x=" << x << ", y=" << y);
|
||||||
CPPUNIT_ASSERT_EQUAL( ref_pos_4[y][x], p );
|
CPPUNIT_ASSERT_EQUAL( ref_pos_4[y][x], p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,6 +57,10 @@ void TextEntryTestCase::TextChangeEvents()
|
|||||||
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
updated.Clear();
|
updated.Clear();
|
||||||
|
|
||||||
|
entry->SetValue("");
|
||||||
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->ChangeValue("bar");
|
entry->ChangeValue("bar");
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
||||||
|
|
||||||
|
@@ -142,7 +142,7 @@ void WindowTestCase::FocusEvent()
|
|||||||
|
|
||||||
m_window->SetFocus();
|
m_window->SetFocus();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, setfocus.GetCount());
|
WX_ASSERT_EVENT_OCCURS(setfocus, 1);
|
||||||
CPPUNIT_ASSERT(m_window->HasFocus());
|
CPPUNIT_ASSERT(m_window->HasFocus());
|
||||||
|
|
||||||
wxButton* button = new wxButton(wxTheApp->GetTopWindow(), wxID_ANY);
|
wxButton* button = new wxButton(wxTheApp->GetTopWindow(), wxID_ANY);
|
||||||
|
@@ -127,6 +127,11 @@ private:
|
|||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Avoid gcc warning about some of the functions defined by the expansion of
|
||||||
|
// the event table macros being unused: they are indeed unused, but we still
|
||||||
|
// want to have them to check that they compile.
|
||||||
|
wxGCC_WARNING_SUPPRESS(unused-function)
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE(MyClassWithEventTable, wxEvtHandler)
|
wxBEGIN_EVENT_TABLE(MyClassWithEventTable, wxEvtHandler)
|
||||||
EVT_IDLE(MyClassWithEventTable::OnIdle)
|
EVT_IDLE(MyClassWithEventTable::OnIdle)
|
||||||
|
|
||||||
@@ -138,6 +143,8 @@ wxBEGIN_EVENT_TABLE(MyClassWithEventTable, wxEvtHandler)
|
|||||||
//EVT_IDLE(MyClassWithEventTable::OnAnotherEvent)
|
//EVT_IDLE(MyClassWithEventTable::OnAnotherEvent)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
wxGCC_WARNING_RESTORE(unused-function)
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,9 +16,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: As all the other tests involving wxUIActionSimulator, this one is
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
// broken under OS X, the test window siply never gets any events.
|
|
||||||
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXOSX__)
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
@@ -204,12 +202,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CPPUNIT_TEST_SUITE( KeyboardEventTestCase );
|
CPPUNIT_TEST_SUITE( KeyboardEventTestCase );
|
||||||
CPPUNIT_TEST( NormalLetter );
|
WXUISIM_TEST( NormalLetter );
|
||||||
CPPUNIT_TEST( NormalSpecial );
|
WXUISIM_TEST( NormalSpecial );
|
||||||
CPPUNIT_TEST( CtrlLetter );
|
WXUISIM_TEST( CtrlLetter );
|
||||||
CPPUNIT_TEST( CtrlSpecial );
|
WXUISIM_TEST( CtrlSpecial );
|
||||||
CPPUNIT_TEST( ShiftLetter );
|
WXUISIM_TEST( ShiftLetter );
|
||||||
CPPUNIT_TEST( ShiftSpecial );
|
WXUISIM_TEST( ShiftSpecial );
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
void NormalLetter();
|
void NormalLetter();
|
||||||
|
@@ -37,7 +37,12 @@
|
|||||||
// some tests there. But this should be fixed and the tests reenabled
|
// some tests there. But this should be fixed and the tests reenabled
|
||||||
// because wxPaintEvent propagation in wxScrolledWindow is a perfect
|
// because wxPaintEvent propagation in wxScrolledWindow is a perfect
|
||||||
// example of fragile code that could be broken under OS X.
|
// example of fragile code that could be broken under OS X.
|
||||||
#ifndef __WXOSX__
|
//
|
||||||
|
// FIXME: Under GTK+ 3 the test is broken because a simple wxYield() is not
|
||||||
|
// enough to map the frame. It should be also fixed there by waiting for
|
||||||
|
// it to come up, with some timeout, but for now it always fails, so
|
||||||
|
// it's useless to run it.
|
||||||
|
#if !defined(__WXOSX__) && !defined(__WXGTK3__)
|
||||||
#define CAN_TEST_PAINT_EVENTS
|
#define CAN_TEST_PAINT_EVENTS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -416,10 +416,12 @@ wxTestGLogHandler(const gchar* domain,
|
|||||||
const gchar* message,
|
const gchar* message,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "** GTK log message while running %s(): ",
|
fprintf(stderr, "\n*** GTK log message while running %s(): ",
|
||||||
wxGetCurrentTestName().c_str());
|
wxGetCurrentTestName().c_str());
|
||||||
|
|
||||||
g_log_default_handler(domain, level, message, data);
|
g_log_default_handler(domain, level, message, data);
|
||||||
|
|
||||||
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
@@ -73,7 +73,7 @@ void TopLevelWindowTestCase::FrameShowTest()
|
|||||||
|
|
||||||
void TopLevelWindowTestCase::TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
void TopLevelWindowTestCase::TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(!tlw->IsShown());
|
CHECK(!tlw->IsShown());
|
||||||
|
|
||||||
wxTextCtrl* textCtrl = new wxTextCtrl(tlw, -1, "test");
|
wxTextCtrl* textCtrl = new wxTextCtrl(tlw, -1, "test");
|
||||||
textCtrl->SetFocus();
|
textCtrl->SetFocus();
|
||||||
@@ -81,19 +81,26 @@ void TopLevelWindowTestCase::TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
|||||||
// only run this test on platforms where ShowWithoutActivating is implemented.
|
// only run this test on platforms where ShowWithoutActivating is implemented.
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||||
tlw->ShowWithoutActivating();
|
tlw->ShowWithoutActivating();
|
||||||
CPPUNIT_ASSERT(tlw->IsShown());
|
CHECK(tlw->IsShown());
|
||||||
CPPUNIT_ASSERT(!tlw->IsActive());
|
CHECK(!tlw->IsActive());
|
||||||
|
|
||||||
tlw->Hide();
|
tlw->Hide();
|
||||||
CPPUNIT_ASSERT(!tlw->IsShown());
|
CHECK(!tlw->IsShown());
|
||||||
CPPUNIT_ASSERT(!tlw->IsActive());
|
CHECK(!tlw->IsActive());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tlw->Show(true);
|
tlw->Show(true);
|
||||||
CPPUNIT_ASSERT(tlw->IsActive());
|
|
||||||
CPPUNIT_ASSERT(tlw->IsShown());
|
// wxGTK needs many event loop iterations before the TLW becomes active and
|
||||||
|
// this doesn't happen in this test, so avoid checking for it.
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
CHECK(tlw->IsActive());
|
||||||
|
#endif
|
||||||
|
CHECK(tlw->IsShown());
|
||||||
|
|
||||||
tlw->Hide();
|
tlw->Hide();
|
||||||
CPPUNIT_ASSERT(!tlw->IsShown());
|
CHECK(!tlw->IsShown());
|
||||||
CPPUNIT_ASSERT(tlw->IsActive());
|
#ifndef __WXGTK__
|
||||||
|
CHECK(tlw->IsActive());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user