18
24
class TestMainWindow(FileManagerTestCase):
21
28
super(TestMainWindow, self).setUp()
23
self.main_window.get_qml_view().visible, Eventually(Equals(True)))
30
self.ubuntusdk.get_qml_view().visible, Eventually(Equals(True)))
26
super(TestMainWindow, self).tearDown()
32
def _patch_home(self):
33
temp_dir = tempfile.mkdtemp()
34
self.addCleanup(shutil.rmtree, temp_dir)
35
patcher = mock.patch.dict('os.environ', {'HOME': temp_dir})
37
self.addCleanup(patcher.stop)
28
39
def test_toolbar_shows(self):
29
"""Make sure that dragging from the bottom reveals the hidden
40
"""Dragging from the bottom reveals the hidden toolbar."""
41
self._make_directory_in_home()
31
43
first_folder = self.main_window.get_folder(0)
32
44
self.tap_item(first_folder)
34
46
action_popover = self.main_window.get_action_popover()
35
47
self.assertThat(lambda: action_popover.opacity, Eventually(Equals(1)))
49
def _make_directory_in_home(self):
50
path = tempfile.mkdtemp(dir=os.environ['HOME'])
51
# Currently, we need to open again the home folder to show the newly
52
# created one. See bug #1190676.
53
# TODO when the bug is fixed, remove the next line.
54
self.ubuntusdk.click_toolbar_button('Home')
57
def test_open_directory(self):
58
sub_dir = self._make_directory_in_home()
60
first_folder = self.main_window.get_folder(0)
61
self.pointing_device.click_object(first_folder)
63
self.main_window.get_current_folder_name,
64
Eventually(Equals(sub_dir)))