diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index e5c4feba52..346100f609 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -1670,20 +1670,27 @@ bool wxGtkDataViewModelNotifier::ValueChanged( const wxDataViewItem &item, unsig GTK_TREE_MODEL(wxgtk_model), &iter )); GdkRectangle cell_area; gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area ); -#ifdef __WXGTK3__ - GtkAdjustment* hadjust = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(widget)); -#else - GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget ); -#endif - double d = gtk_adjustment_get_value( hadjust ); - int xdiff = (int) d; - GtkAllocation a; - gtk_widget_get_allocation(GTK_WIDGET(gtk_tree_view_column_get_button(gcolumn)), &a); - int ydiff = a.height; - // Redraw - gtk_widget_queue_draw_area( GTK_WIDGET(widget), - cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height ); + // Don't try to redraw the column if it's invisible, this just + // results in "BUG" messages from pixman_region32_init_rect() + // and would be useful even if it didn't anyhow. + if ( cell_area.width > 0 && cell_area.height > 0 ) + { +#ifdef __WXGTK3__ + GtkAdjustment* hadjust = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(widget)); +#else + GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget ); +#endif + double d = gtk_adjustment_get_value( hadjust ); + int xdiff = (int) d; + + GtkAllocation a; + gtk_widget_get_allocation(GTK_WIDGET(gtk_tree_view_column_get_button(gcolumn)), &a); + int ydiff = a.height; + // Redraw + gtk_widget_queue_draw_area( GTK_WIDGET(widget), + cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height ); + } } m_internal->ValueChanged( item, model_column ); diff --git a/src/gtk/win_gtk.cpp b/src/gtk/win_gtk.cpp index b0f7721f36..ab6ddd363f 100644 --- a/src/gtk/win_gtk.cpp +++ b/src/gtk/win_gtk.cpp @@ -115,7 +115,14 @@ static void pizza_size_allocate(GtkWidget* widget, GtkAllocation* alloc) child_alloc.height = child->height; if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) child_alloc.x = w - child_alloc.x - child_alloc.width; - gtk_widget_size_allocate(child->widget, &child_alloc); + + // GTK+3 doesn't like allocating 0 size, so don't do it. +#ifdef __WXGTK3__ + if (child_alloc.width && child_alloc.height) +#endif + { + gtk_widget_size_allocate(child->widget, &child_alloc); + } } } } diff --git a/tests/controls/comboboxtest.cpp b/tests/controls/comboboxtest.cpp index 1fe0d004e0..705f406318 100644 --- a/tests/controls/comboboxtest.cpp +++ b/tests/controls/comboboxtest.cpp @@ -145,10 +145,16 @@ void ComboBoxTestCase::PopDismiss() EventCounter close(m_combo, wxEVT_COMBOBOX_CLOSEUP); m_combo->Popup(); + CPPUNIT_ASSERT_EQUAL(1, drop.GetCount()); + m_combo->Dismiss(); - CPPUNIT_ASSERT_EQUAL(1, drop.GetCount()); +#if defined(__WXGTK__) && !defined(__WXGTK3__) + // Under wxGTK2, the event is sent only during idle time and not + // immediately, so we need this yield to get it. + wxYield(); CPPUNIT_ASSERT_EQUAL(1, close.GetCount()); +#endif // wxGTK2 #endif } diff --git a/tests/controls/dialogtest.cpp b/tests/controls/dialogtest.cpp index bc65c2f0ac..3c2decde87 100644 --- a/tests/controls/dialogtest.cpp +++ b/tests/controls/dialogtest.cpp @@ -79,6 +79,13 @@ void ModalDialogsTestCase::FileDialog() CPPUNIT_ASSERT_EQUAL((int)wxID_OK, rc); CPPUNIT_ASSERT_EQUAL("test.txt", dlg.GetFilename()); + +#ifdef __WXGTK3__ + // The native file dialog in GTK+ 3 launches an async operation which tries + // to dereference the already deleted dialog object if we don't let it to + // complete before leaving this function. + wxYield(); +#endif } diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index 19b41ff406..b5c4fddfe9 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -211,21 +211,6 @@ private: void TextEntryTestCase::Editable() { - -#ifdef __WXGTK__ - // FIXME: For some reason this test regularly (although not always) fails - // in wxGTK build bot builds when testing wxBitmapComboBox, but I - // can't reproduce the failure locally. For now, disable this check - // to let the entire test suite pass in automatic tests instead of - // failing sporadically. - if ( wxStrcmp(GetTestWindow()->GetClassInfo()->GetClassName(), - "wxBitmapComboBox") == 0 && - IsAutomaticTest() ) - { - return; - } -#endif // __WGTK__ - wxTextEntry * const entry = GetTestEntry(); wxWindow * const window = GetTestWindow(); @@ -234,6 +219,13 @@ void TextEntryTestCase::Editable() window->SetFocus(); wxYield(); +#ifdef __WXGTK__ + // For some reason, wxBitmapComboBox doesn't appear on the screen without + // this (due to wxTLW size hacks perhaps?). It would be nice to avoid doing + // this, but without this hack the test often (although not always) fails. + wxMilliSleep(50); +#endif // __WGTK__ + // Check that we get the expected number of events. wxUIActionSimulator sim; sim.Text("abcdef"); diff --git a/tests/drawing/fonttest.cpp b/tests/drawing/fonttest.cpp index c7c0a0457d..c439dfca3d 100644 --- a/tests/drawing/fonttest.cpp +++ b/tests/drawing/fonttest.cpp @@ -36,7 +36,9 @@ GraphicsContextDrawingTestCase::ms_drawingFontTc = { void GraphicsContextDrawingTestCase::DoFontDrawings (wxGraphicsContext *gc) { #ifdef __WXGTK__ + wxGCC_WARNING_SUPPRESS(deprecated-declarations) g_type_init(); + wxGCC_WARNING_RESTORE() #endif // This test is expected to treat about fonts/texts. Fonts are a bit special diff --git a/tests/font/fonttest.cpp b/tests/font/fonttest.cpp index 51078680a1..cd5f908ac4 100644 --- a/tests/font/fonttest.cpp +++ b/tests/font/fonttest.cpp @@ -114,10 +114,14 @@ void FontTestCase::Construct() #pragma warning(disable:4996) #endif + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + // Tests relying on the soon-to-be-deprecated ctor taking ints and not // wxFontXXX enum elements. CPPUNIT_ASSERT( wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL).IsOk() ); + wxGCC_WARNING_RESTORE() + #ifdef __VISUALC__ #pragma warning(pop) #endif diff --git a/tests/graphics/ellipsization.cpp b/tests/graphics/ellipsization.cpp index 1b6a20cb04..2a584762f2 100644 --- a/tests/graphics/ellipsization.cpp +++ b/tests/graphics/ellipsization.cpp @@ -86,7 +86,8 @@ void EllipsizationTestCase::NormalCase() wxELLIPSIZE_END }; - int widthsToTest[] = { 50, 100, 150 }; + const int charWidth = dc.GetCharWidth(); + int widthsToTest[] = { 6*charWidth, 10*charWidth, 15*charWidth }; for ( unsigned int s = 0; s < WXSIZEOF(stringsToTest); s++ ) { @@ -110,8 +111,10 @@ void EllipsizationTestCase::NormalCase() WX_ASSERT_MESSAGE ( ( - "invalid ellipsization for \"%s\" (%dpx, should be <=%dpx)", + "Test #(%u,%u.%u): \"%s\" -> \"%s\"; width=%dpx > %dpx", + s, f, m, str, + ret, dc.GetMultiLineTextExtent(ret).GetWidth(), widthsToTest[w] ), diff --git a/tests/html/htmlparser.cpp b/tests/html/htmlparser.cpp index 57687ffe40..29c3cb5c1f 100644 --- a/tests/html/htmlparser.cpp +++ b/tests/html/htmlparser.cpp @@ -19,9 +19,10 @@ #endif #ifndef WX_PRECOMP + #include "wx/dcmemory.h" #endif // WX_PRECOMP -#include "wx/html/htmlpars.h" +#include "wx/html/winpars.h" // ---------------------------------------------------------------------------- // test class @@ -55,7 +56,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HtmlParserTestCase, "HtmlParserTestCase" // Test that parsing invalid HTML simply fails but doesn't crash for example. void HtmlParserTestCase::Invalid() { - class NullParser : public wxHtmlParser + class NullParser : public wxHtmlWinParser { public: virtual wxObject *GetProduct() { return NULL; } @@ -65,6 +66,9 @@ void HtmlParserTestCase::Invalid() }; NullParser p; + wxMemoryDC dc; + p.SetDC(&dc); + p.Parse("<"); p.Parse("SetFocus(); wxYield(); +#ifdef __WXGTK__ + // This is another test which fails with wxGTK without this delay because + // the frame doesn't appear on screen in time. + wxMilliSleep(50); +#endif // __WXGTK__ + wxUIActionSimulator sim; sim.KeyDown(WXK_F1); sim.KeyUp(WXK_F1); diff --git a/tests/test.cpp b/tests/test.cpp index 55f741af62..85060d3cd4 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -559,9 +559,8 @@ bool TestApp::OnInit() cout << std::endl; #if wxUSE_GUI - // create a hidden parent window to be used as parent for the GUI controls - wxTestableFrame* frame = new wxTestableFrame(); - frame->Show(); + // create a parent window to be used as parent for the GUI controls + new wxTestableFrame(); Connect(wxEVT_IDLE, wxIdleEventHandler(TestApp::OnIdle)); #endif // wxUSE_GUI diff --git a/tests/testableframe.cpp b/tests/testableframe.cpp index 1b63defb88..dc535a1f43 100644 --- a/tests/testableframe.cpp +++ b/tests/testableframe.cpp @@ -20,6 +20,8 @@ wxTestableFrame::wxTestableFrame() : wxFrame(NULL, wxID_ANY, "Test Frame") { // Use fixed position to facilitate debugging. Move(200, 200); + + Show(); } void wxTestableFrame::OnEvent(wxEvent& evt)