diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 520f9e2b66..b7f7f387d6 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3687,6 +3687,7 @@ void wxGrid::DoUpdateResizeColWidth(int w) { wxPoint pt(GetColLeft(m_dragRowOrCol) + w, 0); + pt = CalcGridWindowScrolledPosition(pt, m_gridWin); DrawGridDragLine(pt, wxGridColumnOperations(), m_gridWin); } diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 4aae8ae871..a74ceecef5 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -66,10 +66,12 @@ private: CPPUNIT_TEST( CellFormatting ); WXUISIM_TEST( Editable ); WXUISIM_TEST( ReadOnly ); + WXUISIM_TEST( ResizeScrolledHeader ); CPPUNIT_TEST( PseudoTest_NativeHeader ); NONGTK_TEST( LabelClick ); NONGTK_TEST( SortClick ); CPPUNIT_TEST( ColumnOrder ); + WXUISIM_TEST( ResizeScrolledHeader ); CPPUNIT_TEST( PseudoTest_NativeLabels ); NONGTK_TEST( LabelClick ); NONGTK_TEST( SortClick ); @@ -97,6 +99,7 @@ private: void Editable(); void ReadOnly(); void WindowAsEditorControl(); + void ResizeScrolledHeader(); void PseudoTest_NativeHeader() { ms_nativeheader = true; } void PseudoTest_NativeLabels() { ms_nativeheader = false; ms_nativelabels = true; } @@ -806,4 +809,43 @@ void GridTestCase::WindowAsEditorControl() #endif } +void GridTestCase::ResizeScrolledHeader() +{ + // TODO this test currently works only under Windows unfortunately +#if wxUSE_UIACTIONSIMULATOR && defined(__WXMSW__) + int const startwidth = m_grid->GetColSize(0); + int const draglength = 100; + + m_grid->AppendCols(8); + m_grid->Scroll(5, 0); + m_grid->Refresh(); + m_grid->Update(); + + wxRect rect = m_grid->CellToRect(0, 1); + wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition()); + point = m_grid->ClientToScreen(point + + wxPoint(m_grid->GetRowLabelSize(), + m_grid->GetColLabelSize()) + - wxPoint(0, 5)); + + wxUIActionSimulator sim; + + wxYield(); + sim.MouseMove(point); + + wxYield(); + sim.MouseDown(); + + wxYield(); + sim.MouseMove(point + wxPoint(draglength, 0)); + + wxYield(); + sim.MouseUp(); + + wxYield(); + + CPPUNIT_ASSERT_EQUAL(startwidth + draglength, m_grid->GetColSize(0)); +#endif +} + #endif //wxUSE_GRID