From ae237e7c45bdd54beccf184617496dd7a4aea4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Mon, 27 Jul 2020 02:51:35 +0200 Subject: [PATCH 1/4] Fix STC.StartStyling call in unittests See https://github.com/wxWidgets/Phoenix/pull/1643 Fixes https://github.com/wxWidgets/Phoenix/issues/1748 --- unittests/test_stc.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/unittests/test_stc.py b/unittests/test_stc.py index f66ee00c..cee53152 100644 --- a/unittests/test_stc.py +++ b/unittests/test_stc.py @@ -59,16 +59,25 @@ class stc_Tests(wtc.WidgetTestCase): ed.EmptyUndoBuffer() ed.GotoPos(0) - ed.IndicatorSetStyle(0, stc.STC_INDIC_SQUIGGLE) - ed.IndicatorSetForeground(0, wx.RED) - ed.IndicatorSetStyle(1, stc.STC_INDIC_DIAGONAL) - ed.IndicatorSetForeground(1, wx.BLUE) - ed.IndicatorSetStyle(2, stc.STC_INDIC_STRIKE) - ed.IndicatorSetForeground(2, wx.RED) - ed.StartStyling(100, stc.STC_INDICS_MASK) - ed.SetStyling(10, stc.STC_INDIC0_MASK) - ed.SetStyling(8, stc.STC_INDIC1_MASK) - ed.SetStyling(10, stc.STC_INDIC2_MASK | stc.STC_INDIC1_MASK) + ed.INDICSTYLE00 = 0 + ed.INDICSTYLE01 = 1 + ed.INDICSTYLE02 = 2 + + ed.IndicatorSetStyle(ed.INDICSTYLE00, stc.STC_INDIC_SQUIGGLE) + ed.IndicatorSetForeground(ed.INDICSTYLE00, wx.RED) + ed.IndicatorSetStyle(ed.INDICSTYLE01, stc.STC_INDIC_DIAGONAL) + ed.IndicatorSetForeground(ed.INDICSTYLE01, wx.BLUE) + ed.IndicatorSetStyle(ed.INDICSTYLE02, stc.STC_INDIC_STRIKE) + ed.IndicatorSetForeground(ed.INDICSTYLE02, wx.RED) + + ed.StartStyling(100) + + ed.SetIndicatorCurrent(ed.INDICSTYLE00) + ed.IndicatorFillRange(836, 10) + ed.SetIndicatorCurrent(ed.INDICSTYLE01) + ed.IndicatorFillRange(846, 8) + ed.SetIndicatorCurrent(ed.INDICSTYLE02) + ed.IndicatorFillRange(854, 10) def test_stcStyleTextCtrl3(self): @@ -84,11 +93,12 @@ class stc_Tests(wtc.WidgetTestCase): ed.StyleSetSpec(3, "face:%s,bold,size:%d" % (face2, pb)) ed.StyleSetSpec(4, "face:%s,size:%d" % (face1, pb-1)) ed.StyleSetSpec(5, "back:#FFF0F0") - ed.StartStyling(80, 0xff) + + ed.StartStyling(80) ed.SetStyling(6, 1) - ed.StartStyling(100, 0xff) + ed.StartStyling(100) ed.SetStyling(20, 2) - ed.StartStyling(180, 0xff) + ed.StartStyling(180) ed.SetStyling(4, 3) ed.SetStyling(2, 0) ed.SetStyling(10, 4) From 4d2beb5be5468a7f964f71fe9c9a6f6fff329d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Mon, 27 Jul 2020 03:37:03 +0200 Subject: [PATCH 2/4] Fix SearchCtrl test by removing checks for TextCtrl methods Since commit 9eb9497afcf1 ("The new native wxSearchCtrl on GTK does not include the wxTextCtrl methods, just those from wxTextEntry.") the methods are no longer part of the SearchCtrl. --- unittests/test_srchctrl.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/unittests/test_srchctrl.py b/unittests/test_srchctrl.py index 61efde5c..5355181c 100644 --- a/unittests/test_srchctrl.py +++ b/unittests/test_srchctrl.py @@ -48,11 +48,7 @@ class srchctrl_Tests(wtc.WidgetTestCase): t = wx.SearchCtrl(self.frame) t.Cut t.CanCut - t.DiscardEdits - t.GetDefaultStyle - t.GetNumberOfLines - t.GetStyle - t.IsModified + t.IsEditable t.HitTest t.AppendText t.WriteText From 6cd96a3d71886d2ea4feba21771dafafaca77d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Mon, 27 Jul 2020 03:43:47 +0200 Subject: [PATCH 3/4] Fix test, remove check for TB_3DBUTTONS toolbar style The style has been removed for wxWidgets 3.1.0, see https://github.com/wxWidgets/wxWidgets/pull/137 --- unittests/test_toolbar.py | 1 - 1 file changed, 1 deletion(-) diff --git a/unittests/test_toolbar.py b/unittests/test_toolbar.py index fb79d6d0..4ba1089e 100644 --- a/unittests/test_toolbar.py +++ b/unittests/test_toolbar.py @@ -25,7 +25,6 @@ class toolbar_Tests(wtc.WidgetTestCase): wx.TB_BOTTOM wx.TB_RIGHT - wx.TB_3DBUTTONS wx.TB_FLAT wx.TB_DOCKABLE wx.TB_NOICONS From 7015096786ae5a86499afb70c3bc0bf4a6fb16fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Mon, 27 Jul 2020 05:23:01 +0200 Subject: [PATCH 4/4] Fix tests, current wxWidgets uses rounding for wxPoint from real Since wxWigets 3.1.2, several wxPoint/wxRealPoint/wxSize operations no longer truncate results and do correct rounding. Reflect this in the expected results. --- unittests/test_gdicmn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unittests/test_gdicmn.py b/unittests/test_gdicmn.py index b3e64de1..6da427c2 100644 --- a/unittests/test_gdicmn.py +++ b/unittests/test_gdicmn.py @@ -15,7 +15,7 @@ class TestPoint(unittest.TestCase): def test_RealPoint_ctor(self): p = wx.Point(wx.RealPoint(1.2, 2.9)) - self.assertTrue(p == (1,2)) + self.assertTrue(p == (1,3)) def test_copy_ctor(self): p1 = wx.Point(3,4) @@ -299,8 +299,8 @@ class TestSize(unittest.TestCase): assert v1 == (12, 16) assert v2 == (12, 16) - assert v3 == (13, 17) - assert v4 == (14, 19) + assert v3 == (13, 18) + assert v4 == (15, 20) #---------------------------------------------------------------------------