From c6eff96a3ffb3b94366822529be53a4d0cf3592a Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Wed, 25 Jun 2014 16:19:45 +0200 Subject: [PATCH 1/3] - timectrl demo shows all values as invalid/out of bounds - so added a test, but strangely enough that passes, but doesn't hurt --- unittests/test_lib_masked.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/unittests/test_lib_masked.py b/unittests/test_lib_masked.py index a8b3d452..e1bfe7bb 100644 --- a/unittests/test_lib_masked.py +++ b/unittests/test_lib_masked.py @@ -96,6 +96,17 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): #t.Create(self.frame) + def test_timectrlIsValid(self): + t = m.TimeCtrl(self.frame, -1, "18:25:18") + + theTime = t.GetValue(as_wxDateTime=True) + self.assertEqual(theTime.hour, 18, "Hour: %s instead of '18'" % theTime.hour) + self.assertEqual(theTime.minute, 25, "Minutes: %s instead of '18'" % theTime.minute) + self.assertEqual(theTime.second, 18, "Seconds: %s instead of '18'" % theTime.second) + + self.assertEqual(t.IsInBounds(), True) + + def test_timectrlProperties(self): t = m.TimeCtrl(self.frame) From 5b606897ca4ed4e10ca428d425aa89f6cadea708 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Thu, 26 Jun 2014 11:10:04 +0200 Subject: [PATCH 2/3] - test for background color to be correct --- unittests/test_lib_masked.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unittests/test_lib_masked.py b/unittests/test_lib_masked.py index e1bfe7bb..dcc3ce88 100644 --- a/unittests/test_lib_masked.py +++ b/unittests/test_lib_masked.py @@ -95,7 +95,6 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): #t = m.TextCtrl() #t.Create(self.frame) - def test_timectrlIsValid(self): t = m.TimeCtrl(self.frame, -1, "18:25:18") @@ -105,7 +104,7 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): self.assertEqual(theTime.second, 18, "Seconds: %s instead of '18'" % theTime.second) self.assertEqual(t.IsInBounds(), True) - + self.assertEqual(t.GetCtrlParameter('validBackgroundColour'), t.GetBackgroundColour()) def test_timectrlProperties(self): t = m.TimeCtrl(self.frame) From e36c213dd52b7c94d942601b3cd54c800f348ef6 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Thu, 26 Jun 2014 11:10:39 +0200 Subject: [PATCH 3/3] - fix deprecation warning for m_shiftDown --- wx/lib/masked/timectrl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wx/lib/masked/timectrl.py b/wx/lib/masked/timectrl.py index 74f9e39c..f2a4c964 100644 --- a/wx/lib/masked/timectrl.py +++ b/wx/lib/masked/timectrl.py @@ -1254,7 +1254,7 @@ class TimeCtrl(BaseMaskedTextCtrl): def __OnChar(self, event): """ Handler to explicitly look for ':' keyevents, and if found, - clear the m_shiftDown field, so it will behave as forward tab. + clear the shiftDown field, so it will behave as forward tab. It then calls the base control's _OnChar routine with the modified event instance. """ @@ -1263,7 +1263,7 @@ class TimeCtrl(BaseMaskedTextCtrl): ## dbg('keycode:', keycode) if keycode == ord(':'): ## dbg('colon seen! removing shift attribute') - event.m_shiftDown = False + event.shiftDown = False BaseMaskedTextCtrl._OnChar(self, event ) ## handle each keypress ## dbg(indent=0)