1
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 2; coding: utf-8 -*-
3
# This file is part of Déjà Dup.
4
# For copyright information, see AUTHORS.
6
# Déjà Dup 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.
11
# Déjà Dup is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
21
from autopilot.input import Pointer, Touch
22
from autopilot.matchers import Eventually
23
from autopilot.testcase import AutopilotTestCase
24
from deja_dup_autopilot import system_only
25
from testtools.matchers import Equals, NotEquals
28
class CCPanelTests(AutopilotTestCase):
32
super(CCPanelTests, self).setUp()
33
self.pointer = Pointer(Touch.create())
35
panel_dir = subprocess.check_output(["pkg-config",
36
"--variable=extensiondir",
37
"libgnome-control-center"]).strip()
38
if not os.path.exists(os.path.join(panel_dir, "libdeja-dup.so")):
39
self.skip("Skipping ccpanel test because the panel is not installed")
41
def test_clean_exit(self):
42
"""Launch and close the panel a couple times. If we don't properly clean
43
up after ourselves when we are disposed, this may cause a crash."""
44
app = self.launch_test_application('gnome-control-center', 'deja-dup')
45
window = app.select_single("GtkApplicationWindow")
46
self.assertThat(window.title, Eventually(Equals("Backup")))
47
self.close_backup_panel(window)
48
self.open_backup_panel(window)
49
self.close_backup_panel(window)
51
def open_backup_panel(self, window):
52
# This is dumb, but GtkIconView doesn't seem to list its contents to
53
# autopilot. TODO: make this actually click on Backup icon in window
54
os.system('gnome-control-center deja-dup')
55
self.assertThat(window.title, Eventually(Equals("Backup")))
57
def close_backup_panel(self, window):
58
button = window.select_single("GtkButton", label="_All Settings")
59
self.pointer.click_object(button)
60
self.assertThat(window.title, Eventually(NotEquals("Backup")))