|
@@ -4,16 +4,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
-from typing import Callable, Dict, Iterable, List
|
|
|
+from typing import Dict, List, Tuple
|
|
|
from pytest import fixture, mark
|
|
|
from app.parse_recipe import parse_recipe
|
|
|
from app.data.QueryManager import QueryManager
|
|
|
from app.rest import ALL_UNITS
|
|
|
|
|
|
-from app.widgets import SuggestionPopup
|
|
|
-from urwid import connect_signal
|
|
|
-from urwid import SimpleFocusListWalker
|
|
|
-from additional_urwid_widgets import IndicativeListBox
|
|
|
+from app.widgets import (
|
|
|
+ SuggestionPopup,
|
|
|
+ FlowBarGraphWithVScale,
|
|
|
+)
|
|
|
|
|
|
@fixture
|
|
|
def signals():
|
|
@@ -49,4 +49,24 @@ def test_suggestion_popup_choice(suggestion_popup: SuggestionPopup, tracker: Dic
|
|
|
def test_suggestion_popup_banish(suggestion_popup: SuggestionPopup, tracker: Dict[str, str], options: List[str], signals):
|
|
|
suggestion_popup.keypress((0,0), 'esc')
|
|
|
assert len(tracker.keys()) == 0
|
|
|
- assert 'close' in signals
|
|
|
+ assert 'close' in signals
|
|
|
+
|
|
|
+@fixture
|
|
|
+def bargraph():
|
|
|
+ return FlowBarGraphWithVScale(
|
|
|
+ 50, 14,
|
|
|
+ ['bg','popup_focus', 'badge_neutral' ],
|
|
|
+ hatt=['dark red', 'dark red', 'dark red']
|
|
|
+ )
|
|
|
+
|
|
|
+@mark.parametrize('vscale', [
|
|
|
+ list(map(float, (1, 2, 3))),
|
|
|
+ None,
|
|
|
+])
|
|
|
+def test_flow_bar_graph_with_vscale(bargraph: FlowBarGraphWithVScale, vscale: Tuple[float]):
|
|
|
+ bargraph.set_data([1,2,3], 3, vscale=vscale)
|
|
|
+ bargraph.set_caption('my data')
|
|
|
+ assert bargraph.total_width == 50
|
|
|
+ assert bargraph.canvas_width == 50 - bargraph._vscale_width
|
|
|
+ assert bargraph.height == 14
|
|
|
+ bargraph.set_bar_width(2)
|