Sha256: 286ca6d162e9eabaf7f4597ba7245fd5d4c736fc1c092d2dc1121e0cc4731d75

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

class Calculator < Autogui::Application

  # initialize with the binary name 'calc' and the window title
  # 'Calculator' used along with the application pid to find the 
  # main application window
  def initialize(options = {})
    defaults = {
                 :name => "calc",
                 :title => "Calculator"
               }
    super defaults.merge(options)
  end

  # the calculator's results window 
  def edit_window
    main_window.children.find {|w| w.window_class == 'Edit'}
  end

  # About dialog, hotkey (VK_MENU, VK_H, VK_A)
  def dialog_about
    Autogui::EnumerateDesktopWindows.new.find do |w| 
      w.title.match(/About Calculator/) && (w.pid == pid)
    end
  end

  # the 'CE' button
  def clear_entry
    set_focus
    keystroke(VK_DELETE)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
win32-autogui-0.3.0 spec/applications/calculator.rb
win32-autogui-0.2.1 spec/applications/calculator.rb
win32-autogui-0.2.0 spec/applications/calculator.rb