Unity 8
test_display_indicator.py
1 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2 #
3 # Unity Indicators Autopilot Test Suite
4 # Copyright (C) 2015 Canonical
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 from unity8 import (
20  fixture_setup,
21  indicators,
22 )
23 from unity8.indicators import tests
24 
25 
26 class DisplayIndicatorTestCase(tests.IndicatorTestCase):
27 
28  def test_indicator_icon_must_be_visible_after_rotation_locked(self):
29  rotation_unlocked = fixture_setup.DisplayRotationLock(False)
30  self.useFixture(rotation_unlocked)
31  display_indicator = indicators.DisplayIndicator(self.main_window)
32  self.assertFalse(display_indicator.is_indicator_icon_visible())
33 
34  display_indicator_page = display_indicator.open()
35  display_indicator_page.lock_rotation()
36  display_indicator.close()
37 
38  self.assertTrue(display_indicator.is_indicator_icon_visible())
39 
40  def test_indicator_icon_must_not_be_visible_after_rotation_unlocked(self):
41  rotation_locked = fixture_setup.DisplayRotationLock(True)
42  self.useFixture(rotation_locked)
43  display_indicator = indicators.DisplayIndicator(self.main_window)
44  self.assertTrue(display_indicator.is_indicator_icon_visible())
45 
46  display_indicator_page = display_indicator.open()
47  display_indicator_page.unlock_rotation()
48  display_indicator.close()
49 
50  self.assertFalse(display_indicator.is_indicator_icon_visible())