blob: d774118f999732e62b4af3e557ada7068b01f80f [file] [log] [blame]
Javi Merino7f3c8a62014-06-13 11:38:58 +01001#!/usr/bin/python
2
3import unittest
4
Javi Merino6a5c88d2014-06-19 09:43:18 +01005from test_thermal import TestThermalBase
6import cr2
Javi Merino7f3c8a62014-06-13 11:38:58 +01007import plot_utils
8
9class TestPlotUtils(unittest.TestCase):
10 def test_set_plot_size(self):
11 """Test that plot_utils.set_plot_size() doesn't bomb"""
12 plot_utils.set_plot_size(None, None)
13 plot_utils.set_plot_size(height=9, width=None)
14 plot_utils.set_plot_size(height=None, width=9)
15 plot_utils.set_plot_size(3, 9)
16
17 def test_normalize_title(self):
18 """Test normalize_title"""
19 self.assertEquals(plot_utils.normalize_title("Foo", ""), "Foo")
20 self.assertEquals(plot_utils.normalize_title("Foo", "Bar"), "Bar - Foo")
Javi Merino3a736552014-06-19 19:22:44 +010021
22 def test_post_plot_setup(self):
23 """Test that post_plot_setup() doesn't bomb"""
24
25 ax = plot_utils.pre_plot_setup()
26
27 plot_utils.post_plot_setup(ax)
28 plot_utils.post_plot_setup(ax, title="Foo")
29 plot_utils.post_plot_setup(ax, ylim=(0, 72))
Javi Merinof9d43af2014-06-21 16:32:04 +010030 plot_utils.post_plot_setup(ax, xlabel="Bar")
Javi Merinod04643f2014-06-21 17:00:16 +010031 plot_utils.post_plot_setup(ax, xlim=(0, 100))
Javi Merino6a5c88d2014-06-19 09:43:18 +010032
33class TestPlotUtilsNeedTrace(TestThermalBase):
34 def test_plot_allfreqs(self):
35 """Test that plot_allfreqs() doesn't bomb"""
36
37 inp = cr2.InPower()
38 outp = cr2.OutPower()
39 map_label = {"0000000f": "A7", "000000f0": "A15"}
40
41 plot_utils.plot_allfreqs(inp, outp, map_label)