File: test.rb

package info (click to toggle)
subtle 0.11.3224-xi-2.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 1,288 kB
  • ctags: 1,378
  • sloc: ansic: 14,703; ruby: 3,101; makefile: 16
file content (74 lines) | stat: -rw-r--r-- 1,666 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/ruby
#
# @package test
#
# @file Run riot unit tests
# @author Christoph Kappel <unexist@subforge.org>
# @version $Id: test/test.rb,v 3131 2011/11/15 20:43:06 unexist $
#
# This program can be distributed under the terms of the GNU GPLv2.
# See the file COPYING for details.
#

# Configuration
subtle   = "../subtle"
subtlext = "../subtlext.so"
config   = "../data/subtle.rb"
sublets  = "./sublet"
display  = ":10"

begin
  require "mkmf"
  require "riot"
  require "gtk2/base"
  require subtlext
rescue LoadError => missing
  puts <<EOF
>>> ERROR: Couldn't find the gem `#{missing}'
>>>        Please install it with following command:
>>>        gem install #{missing}
EOF
end

def fork_and_forget(cmd)
  pid = Process.fork
  if pid.nil?
    exec(cmd)
  else
    Process.detach(pid)
  end
end

# Find xterm
if (xterm = find_executable0("xterm")).nil?
  raise "xterm not found in path"
end

# Start subtle
fork_and_forget("#{subtle} -d #{display} -c #{config} -s #{sublets} &>/dev/null")

sleep 1

# Create dummy tray icon
Gtk.init(["--display=%s" % [ display ]])

Gtk::StatusIcon.new

# Set subtlext display
Subtlext::Subtle.display = display

# Run tests
require_relative "contexts/subtle_init.rb"
require_relative "contexts/color.rb"
require_relative "contexts/geometry.rb"
require_relative "contexts/gravity.rb"
require_relative "contexts/icon.rb"
require_relative "contexts/screen.rb"
require_relative "contexts/sublet.rb"
require_relative "contexts/tag.rb"
require_relative "contexts/view.rb"
require_relative "contexts/client.rb"
require_relative "contexts/tray.rb"
require_relative "contexts/subtle_finish.rb"

# vim:ts=2:bs=2:sw=2:et:fdm=marker