diff --git a/tests/view/plotting/plotting_widget/test_plotting_helper.py b/tests/view/plotting/plotting_widget/test_plotting_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..66570fd7c44172f02bfca4925ce3b0277e1dedaf --- /dev/null +++ b/tests/view/plotting/plotting_widget/test_plotting_helper.py @@ -0,0 +1,26 @@ +from unittest import TestCase + +from sohstationviewer.view.plotting.plotting_widget.plotting_helper import ( + get_colors_sizes_for_abs_y_from_value_colors +) +from sohstationviewer.view.util.color import clr + + +class TestGetColorsSizesForAbsYFromValueColors(TestCase): + def test_get_colors_sizes_for_abs_y_from_value_colors(self): + y = [0, 0.5, 1., 2., 3., 4., 5., 7., 7.1, + -0, -0.5, -1., -2., -3., -4., -5., -7., -7.1] + value_colors = [(0.5, 'C'), (2.0, 'G'), (4.0, 'Y'), + (7.0, 'R'), (7.0, 'M')] + colors, sizes = get_colors_sizes_for_abs_y_from_value_colors( + y, value_colors) + + self.assertEqual( + colors, + [clr['C'], clr['C'], clr['G'], clr['G'], clr['Y'], clr['Y'], + clr['R'], clr['R'], clr['M'], + clr['C'], clr['C'], clr['G'], clr['G'], clr['Y'], clr['Y'], + clr['R'], clr['R'], clr['M'] + ] + ) + self.assertEqual(sizes, [1.5] * len(y))