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  # TODO remove the skip when the bug is fixed. --elopio - 2015-01-20
30  self.skipTest(
31  'This test fails because of bug http://pad.lv/1410915')
32  rotation_unlocked = fixture_setup.DisplayRotationLock(False)
33  self.useFixture(rotation_unlocked)
34  display_indicator = indicators.DisplayIndicator(self.main_window)
35  self.assertFalse(display_indicator.is_indicator_icon_visible())
36 
37  display_indicator_page = display_indicator.open()
38  display_indicator_page.lock_rotation()
39  display_indicator.close()
40 
41  self.assertTrue(display_indicator.is_indicator_icon_visible())
42 
43  def test_indicator_icon_must_not_be_visible_after_rotation_unlocked(self):
44  rotation_locked = fixture_setup.DisplayRotationLock(True)
45  self.useFixture(rotation_locked)
46  display_indicator = indicators.DisplayIndicator(self.main_window)
47  self.assertTrue(display_indicator.is_indicator_icon_visible())
48 
49  display_indicator_page = display_indicator.open()
50  display_indicator_page.unlock_rotation()
51  display_indicator.close()
52 
53  self.assertFalse(display_indicator.is_indicator_icon_visible())