def testCreateShortcut(self): setupWizard = SetupWizard("Mock setup wizard") setupWizard.init() WineShortcut.wizard(setupWizard).withName("Shortcut name")\ .withExecutableName("winecfg")\ .withArguments(["argument 1", "argument 2"])\ .withWineDebug("-all")\ .withWorkingDirectory("Working directory")\ .withWinePrefix("Wine prefix")\ .create() shortcuts = Environment.getShortcutsPath() shortcut = os.path.join(shortcuts, "Shortcut name") shortcutFileContent = open(shortcut, "r").read() shortcutJson = json.loads(shortcutFileContent) self.assertEquals("com.playonlinux.library.shortcuts.WineShortcut", shortcutJson["@class"]) self.assertEquals("-all", shortcutJson["wineDebug"]) self.assertEquals("Wine prefix", shortcutJson["winePrefix"]) self.assertEquals("Working directory", shortcutJson["workingDirectory"]) self.assertEquals("winecfg", shortcutJson["executableName"]) self.assertEquals("argument 1", shortcutJson["arguments"][0]) self.assertEquals("argument 2", shortcutJson["arguments"][1]) setupWizard.close()
def POL_Shortcut(self): setupWindowId = self.command[2] setupWindow = self.setupWindowManager.getWindow(setupWindowId) winePrefix = self.command[3] binary = self.command[4] shortcutName = self.command[5] websiteIcon = self.command[6] argument = self.command[7] categories = self.command[8] WineShortcut.wizard(setupWindow)\ .withArguments([argument])\ .withExecutableName(binary)\ .withWinePrefix(winePrefix)\ .withName(shortcutName)\ .create()