51
50
TransactionTypes.INSTALL)
55
def test_unity_launcher_integration(self):
56
# test the automatic add to launcher enabled functionality
57
available_pane.add_to_launcher_enabled = True
58
test_pkgname = "lincity-ng"
60
mock_result.pkgname = test_pkgname
61
mock_result.success = True
63
self._navigate_to_appdetails_and_install(test_pkgname)
65
# check that a correct UnityLauncherInfo object has been created and
67
self.assertTrue(test_pkgname in available_pane.unity_launcher.launcher_queue)
68
launcher_info = available_pane.unity_launcher.remove_from_launcher_queue(test_pkgname)
69
# check the UnityLauncherInfo values themselves
70
self.assertEqual(launcher_info.name, "lincity-ng")
71
self.assertEqual(launcher_info.icon_name, "lincity-ng")
54
def _fake_send_application_to_launcher_and_check(self,
55
pkgname, launcher_info):
56
self.assertEqual(pkgname, self.expected_pkgname)
57
self.assertEqual(launcher_info.name, self.expected_launcher_info.name)
58
self.assertEqual(launcher_info.icon_name,
59
self.expected_launcher_info.icon_name)
72
60
self.assertTrue(launcher_info.icon_x > 5)
73
61
self.assertTrue(launcher_info.icon_y > 5)
74
62
self.assertEqual(launcher_info.icon_size, 96)
75
63
self.assertEqual(launcher_info.app_install_desktop_file_path,
76
"/usr/share/app-install/desktop/lincity-ng:lincity-ng.desktop")
77
self.assertEqual(launcher_info.trans_id, "testid101")
78
# finally, make sure the the app has been removed from the launcher
80
self.assertFalse(test_pkgname in available_pane.unity_launcher.launcher_queue)
64
self.expected_launcher_info.app_install_desktop_file_path)
65
self.assertEqual(launcher_info.trans_id,
66
self.expected_launcher_info.trans_id)
68
def test_unity_launcher_integration(self):
69
# test the automatic add to launcher enabled functionality
70
available_pane.add_to_launcher_enabled = True
71
test_pkgname = "lincity-ng"
73
# for testing, we substitute a fake version of UnityLauncher's
74
# send_application_to_launcher method that lets us check for the
75
# correct values and also avoids firing the actual dbus signal
76
# to the unity launcher service
77
self.expected_pkgname = test_pkgname
78
self.expected_launcher_info = UnityLauncherInfo("lincity-ng",
80
0, 0, 0, 0, # these values are set in availablepane
81
"/usr/share/app-install/desktop/lincity-ng:lincity-ng.desktop",
83
available_pane.unity_launcher.send_application_to_launcher = (
84
self._fake_send_application_to_launcher_and_check)
85
self._navigate_to_appdetails_and_install(test_pkgname)
82
87
def test_unity_launcher_integration_disabled(self):
83
88
# test the case where automatic add to launcher is disabled
84
89
available_pane.add_to_launcher_enabled = False
85
90
test_pkgname = "lincity-ng"
87
mock_result.pkgname = test_pkgname
88
mock_result.success = True
92
# for testing, we substitute a fake version of UnityLauncher's
93
# send_application_to_launcher method that lets us check for the
94
# correct values and also avoids firing the actual dbus signal
95
# to the unity launcher service
96
# in the disabled add to launcher case, we just want to insure
97
# that we never call send_application_to_launcher, so we can just
98
# plug in bogus values and we will catch a call if it occurs
99
self.expected_pkgname = ""
100
self.expected_launcher_info = UnityLauncherInfo("", "",
102
available_pane.unity_launcher.send_application_to_launcher = (
103
self._fake_send_application_to_launcher_and_check)
90
104
self._navigate_to_appdetails_and_install(test_pkgname)
92
# check that no corresponding unity_launcher info object has been added
94
self.assertFalse(test_pkgname in available_pane.unity_launcher.launcher_queue)
96
106
def test_desktop_file_path_conversion(self):
97
107
# test 'normal' case