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.DeviceIndicatorTestCase):
27 
28  scenarios = tests.IndicatorTestCase.device_emulation_scenarios
29 
30  def test_indicator_icon_must_be_visible_after_rotation_locked(self):
31  rotation_unlocked = fixture_setup.DisplayRotationLock(False)
32  self.useFixture(rotation_unlocked)
33  display_indicator = indicators.DisplayIndicator(self.main_window)
34  self.assertFalse(display_indicator.is_indicator_icon_visible())
35 
36  display_indicator_page = display_indicator.open()
37  display_indicator_page.lock_rotation()
38  display_indicator.close()
39 
40  self.assertTrue(display_indicator.is_indicator_icon_visible())
41 
42  def test_indicator_icon_must_not_be_visible_after_rotation_unlocked(self):
43  rotation_locked = fixture_setup.DisplayRotationLock(True)
44  self.useFixture(rotation_locked)
45  display_indicator = indicators.DisplayIndicator(self.main_window)
46  self.assertTrue(display_indicator.is_indicator_icon_visible())
47 
48  display_indicator_page = display_indicator.open()
49  display_indicator_page.unlock_rotation()
50  display_indicator.close()
51 
52  self.assertFalse(display_indicator.is_indicator_icon_visible())