From 38ebee6aad770b456d93c7771f57b69e520f4df0 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 8 May 2019 10:35:32 +0100
Subject: [PATCH] TEST: test idle.block

---
 tests/test_idle.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/test_idle.py b/tests/test_idle.py
index 13a8e3c98..430e49fa0 100644
--- a/tests/test_idle.py
+++ b/tests/test_idle.py
@@ -157,6 +157,29 @@ def _test_idleTimeout():
     assert idle.getIdleTimeout() == default
 
 
+@pytest.mark.wxtest
+def test_block_with_gui():    _run_with_wx(   _test_block)
+def test_block_without_gui(): _run_without_wx(_test_block)
+def _test_block():
+
+    called = [False]
+
+    if fslplatform.haveGui:
+        import wx
+        def idlefunc():
+            called[0] = True
+        wx.CallLater(1000, idlefunc)
+
+    start = time.time()
+
+    idle.block(2)
+    end = time.time()
+    assert (end - start) >= 2
+
+    if fslplatform.haveGui:
+        assert called[0]
+
+
 @pytest.mark.wxtest
 def test_idle():
 
-- 
GitLab