def _get_unity_launcher_info(self, app, appdetails, trans_id):
     (icon_size, icon_x,
      icon_y) = (self._get_onscreen_icon_details_for_launcher_service(app))
     icon_path = get_file_path_from_iconname(
         self.icons, iconname=appdetails.icon_file_name)
     launcher_info = UnityLauncherInfo(app.name, appdetails.icon, icon_path,
                                       icon_x, icon_y, icon_size,
                                       appdetails.desktop_file, trans_id)
     return launcher_info
예제 #2
0
 def test_unity_launcher_integration_disabled(self):
     # test the case where automatic add to launcher is disabled
     available_pane.add_to_launcher_enabled = False
     test_pkgname = "lincity-ng"
     # now pretend
     # for testing, we substitute a fake version of UnityLauncher's
     # send_application_to_launcher method that lets us check for the
     # correct values and also avoids firing the actual dbus signal
     # to the unity launcher service
     # in the disabled add to launcher case, we just want to insure
     # that we never call send_application_to_launcher, so we can just
     # plug in bogus values and we will catch a call if it occurs
     self.expected_pkgname = ""
     self.expected_launcher_info = UnityLauncherInfo("", "",
              0, 0, 0, 0, "", "")
     available_pane.unity_launcher.send_application_to_launcher = (
             self._fake_send_application_to_launcher_and_check)
     self._navigate_to_appdetails_and_install(test_pkgname)
예제 #3
0
 def test_unity_launcher_integration_list_view(self):
     # test the automatic add to launcher enabled functionality when
     # installing an app form the list view
     available_pane.add_to_launcher_enabled = True
     test_pkgname = "lincity-ng"
     # now pretend
     # for testing, we substitute a fake version of UnityLauncher's
     # send_application_to_launcher method that lets us check for the
     # correct values and also avoids firing the actual dbus signal
     # to the unity launcher service
     self.expected_pkgname = test_pkgname
     self.expected_launcher_info = UnityLauncherInfo("lincity-ng",
              "lincity-ng",
              0, 0, 0, 0, # these values are set in availablepane
              "/usr/share/app-install/desktop/lincity-ng:lincity-ng.desktop",
              "testid101")
     available_pane.unity_launcher.send_application_to_launcher = (
             self._fake_send_application_to_launcher_and_check)
     self._install_from_list_view(test_pkgname)
 def _get_unity_launcher_info(self, app, appdetails,
                              installed_desktop_file_path, trans_id):
     (icon_size, icon_x,
      icon_y) = (self._get_onscreen_icon_details_for_launcher_service(app))
     icon_path = get_file_path_from_iconname(self.icons,
                                             iconname=appdetails.icon)
     # Note that the transaction ID is not specified because we are firing
     # the dbus signal at the very end of the installation now, and the
     # corresponding fix in Unity is expecting this value to be empty (it
     # would not be useful to the Unity launcher at this point anyway,
     # as the corresponding transaction would be complete).
     # Please see bug LP: #925014 and corresponding Unity branch for
     # further details.
     # TODO: If and when we re-implement firing the dbus signal at the
     # start of the transaction, at that time we will need to replace
     # the empty string below with the trans_id value.
     launcher_info = UnityLauncherInfo(app.name, appdetails.icon, icon_path,
                                       icon_x, icon_y, icon_size,
                                       installed_desktop_file_path, "")
     return launcher_info
예제 #5
0
 def test_unity_launcher_integration_list_view(
         self, mock_send_application_to_launcher):
     # test the automatic add to launcher enabled functionality when
     # installing an app from the list view
     available_pane.add_to_launcher_enabled = True
     test_pkgname = "software-center"
     self.expected_pkgname = test_pkgname
     self.expected_launcher_info = UnityLauncherInfo(
         "software-center",
         "softwarecenter",
         0,
         0,
         0,
         0,  # these values are set in availablepane
         "/usr/share/applications/ubuntu-software-center.desktop",
         "")
     self._install_from_list_view(test_pkgname)
     self.assertTrue(mock_send_application_to_launcher.called)
     args, kwargs = mock_send_application_to_launcher.call_args
     self._check_send_application_to_launcher_args(*args, **kwargs)
예제 #6
0
 def test_unity_launcher_integration_details_view(
         self, mock_send_application_to_launcher):
     # test the automatic add to launcher enabled functionality when
     # installing an app from the details view
     self.config.add_to_unity_launcher = True
     test_pkgname = "software-center"
     self.expected_pkgname = test_pkgname
     self.expected_launcher_info = UnityLauncherInfo(
         "software-center",
         "softwarecenter",
         0,
         0,
         0,
         0,  # these values are set in availablepane
         "/usr/share/app-install/desktop/software-center:ubuntu-software-center.desktop",
         "testid101")
     self._navigate_to_appdetails_and_install(test_pkgname)
     self.assertTrue(mock_send_application_to_launcher.called)
     args, kwargs = mock_send_application_to_launcher.call_args
     self._check_send_application_to_launcher_args(*args, **kwargs)
예제 #7
0
    def test_apps_from_sc_agent(self, mock_dbus_iface):
        mock_iface = Mock()
        mock_dbus_iface.return_value = mock_iface
        launcher_info = UnityLauncherInfo(
            name="Meep", icon_name="icon-meep", 
            icon_file_path="/tmp/icon-meep.png", icon_x=15, icon_y=18,
            icon_size=48, installed_desktop_file_path="software-center-agent",
            trans_id="dkfjklsdf")
        unity_launcher = UnityLauncher()
        unity_launcher.send_application_to_launcher("meep-pkg", launcher_info)
        args = mock_iface.AddLauncherItemFromPosition.call_args[0]
        # basic verify
        self.assertEqual(args[0], "Meep")
        # ensure that the a app from software-center-agent got a temp desktop
        # file
        self.assertTrue(args[5].startswith("/tmp/"))
        self.assertEqual(open(args[5]).read(),"""
[Desktop Entry]
Name=Meep
Icon=/tmp/icon-meep.png
Type=Application""")