class SystemTests::AbstractSystemTest

Constants

SERVER_URI

Public Instance Methods

apple_script(script) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 42
def apple_script(script)
  if OS.mac?
    `osascript -e 'tell application "System Events" to tell (every process whose unix id is #{@gam_pid})
      set frontmost to true
      
      #{script}
    end tell'`
  end
end
cliclick_drag_end(x,y) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 38
def cliclick_drag_end(x,y)
  `cliclick du:#{x},#{y}`
end
cliclick_drag_start(x,y) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 34
def cliclick_drag_start(x,y)
  `cliclick dd:#{x},#{y}`
end
drag_mouse_from_to_in_gam_window(from, to) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 23
def drag_mouse_from_to_in_gam_window(from, to)
  apple_script("set position of window 1 to {0, 0}")

  cliclick_drag_start(*from)
  cliclick_drag_end(*to) 
end
drb_interface() click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 15
def drb_interface
  @drb_interface ||= DRbObject.new_with_uri(SERVER_URI)
end
open_gam_window(&block) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 52
def open_gam_window(&block)
  outer_self = self
  Open3.popen3("ruby runnable.rb") do |stdin, stdout, stderr, thread|
    Thread.new {
      open('/var/log/gam.stderr', 'a') { |f|
        begin
          while line = stderr.gets
            f << line
          end
        rescue IOError
        end
      }
    }

    @gam_pid = thread.pid
    sleep 2

    outer_self.instance_exec(stdin, stdout, &block)

    Process.kill('KILL', @gam_pid)
  end
end
scroll_out_in_gam_window(factor) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 30
def scroll_out_in_gam_window(factor)
  `cliclick sp:#{factor},0,0`
end
send_keypress_to_gam_window(key) click to toggle source
# File eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb, line 19
def send_keypress_to_gam_window(key)
  apple_script("keystroke \"#{key}\"")
end