From 0518571f910176d07298ea3d5f63e8e68f7a9c1f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 23 Jun 2020 18:33:47 +0200 Subject: tests: Set splitter handle width for InspectorSplitter tests How the handle width of 5 is distributed on macOS seems like totally random. Instead of trying to get our calculations to work, just force the handle width to an even number. --- tests/unit/misc/test_miscwidgets.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/unit/misc/test_miscwidgets.py b/tests/unit/misc/test_miscwidgets.py index e48c9721c..c31c53373 100644 --- a/tests/unit/misc/test_miscwidgets.py +++ b/tests/unit/misc/test_miscwidgets.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -import math import logging from unittest import mock @@ -271,7 +270,9 @@ class TestInspectorSplitter: splitter.show() resize(old_window_size) - handle_width = splitter.handleWidth() + handle_width = 4 + splitter.setHandleWidth(handle_width) + splitter_idx = 1 if position in [inspector.Position.left, inspector.Position.top]: splitter_pos = preferred_size - handle_width//2 @@ -284,9 +285,9 @@ class TestInspectorSplitter: sizes = splitter.sizes() inspector_size = sizes[splitter._inspector_idx] main_size = sizes[splitter._main_idx] - exp_main_size = (new_window_size - - exp_inspector_size - - math.ceil(handle_width/2)) + exp_main_size = new_window_size - exp_inspector_size + + exp_main_size -= handle_width // 2 exp_inspector_size -= handle_width // 2 assert (inspector_size, main_size) == (exp_inspector_size, -- cgit v1.2.3-54-g00ecf