# File AgileGuiTesting.rb, line 425
def wait_for_xycolor_to_go_away(*data)
  raise "invalid # of args to wait_for_xycolor" if data.length < 3 || data.length > 7

  pause = 30
  x = data[0]
  y = data[1]
  if data.length >= 5
    r = data[2]
    g = data[3]
    b = data[4]
    pause = data[5] if data.length >= 6
    exception_mode = data[6] if data.length == 7
  elsif data.length == 3 || data.length == 4
    colorname = data[2]
    # colorname should be an array w/ 3 elements

    raise "invalid # of elements in 'colorname' array in wait_for_xycolor" if colorname.length != 3
    r = colorname[0]
    g = colorname[1]
    b = colorname[2]
    pause = data[3] if data.length == 4
  end

  if wait_for_color_to_go_away(x,y,r,g,b,pause)
    sleep 0.25
  else
    # program should die here

    puts "     ***************************************"
    puts "     ********** DIED WHILE WAITING *********"
    puts "     ***************************************"
    puts "Waited #{pause} seconds, but did not find the color"
    puts "(#{r}/#{g}/#{b}) at (#{x}, #{y}), quitting"
    puts "Here are the comments you provided (in order):"
    write_comments
    if exception_mode
      raise "COLOR (#{r}/#{g}/#{b}) at (#{x}, #{y}) NOT FOUND"
    else
      exit
    end
  end
end