3
import os # system, path
4
import subprocess # system, path
5
from Test import Test, key, set_param
6
from CairoDock import CairoDock
9
class TestCustomLauncher(Test):
10
def __init__(self, dock):
11
self.test_file='/tmp/cairo-dock-test'
12
Test.__init__(self, "Test custom launcher", dock)
15
if os.path.exists(self.test_file):
16
os.remove(self.test_file)
18
# add a new custom launcher at the beginning of the dock
19
conf_file = self.d.Add({'type':'Launcher', 'name':'xxx', 'command':'echo -n 321 > '+self.test_file, 'icon':'gtk-home.png', 'position':1})
20
if conf_file == None or conf_file == "" or not os.path.exists(conf_file):
21
self.print_error ("Failed to add the launcher")
25
set_param (conf_file, "Desktop Entry", "Name", "Test launcher")
26
set_param (conf_file, "Desktop Entry", "Exec", "echo -n 123 > \/tmp\/cairo-dock-test")
27
self.d.Reload('config-file='+conf_file)
31
key("2") # 'position' starts from 0, but numbers on the icons start from 1
34
f = open('/tmp/cairo-dock-test', 'r')
37
self.print_error ("Failed to reload the launcher")
39
self.print_error ("[Test custom launcher] Failed to activate the launcher")
42
self.d.Remove('config-file='+conf_file);
43
if os.path.exists(conf_file):
44
self.print_error ("Failed to remove the launcher")