Sha256: 3ce53b3bf5f5bdd167783a94d906357b87c25d0829649d5123023b3f70ea3a74

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require "spec_helper"

describe "Win32::Mouse", :if => SpecHelper.adapter == :win_32 do

  it "#click" do
    window = RAutomation::Window.new(:title => "MainFormWindow")

    popup = RAutomation::Window.new(:title => "About")
    popup.should_not be_present

    window.maximize
    mouse = window.mouse
    mouse.move :x => 60, :y => 45
    mouse.click

    RAutomation::WaitHelper.wait_until {popup.present?}
  end

  it "#position" do
    window = RAutomation::Window.new(:title => "MainFormWindow")
    mouse = window.mouse

    mouse.move :x => 13, :y => 16
    mouse.position.should == {:x => 13, :y => 16}
  end

  it "#press/#release" do
    window = RAutomation::Window.new(:title => "MainFormWindow")
    window.maximize

    text_field = window.text_field(:index => 1)
    text_field.set("start string")
    text_field.value.should == "start string"

    mouse = window.mouse
    mouse.move :x => 146, :y => 103
    mouse.press
    mouse.move :x => 194
    mouse.release
    window.send_keys [:control, "c"]

    text_field.set("new string")
    text_field.value.should == "new string"

    mouse.move :x => 146
    mouse.press
    mouse.move :x => 194
    mouse.release
    window.send_keys [:control, "v"]

    text_field.value.should == "start string"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rautomation-0.7.3 spec/adapter/win_32/mouse_spec.rb
rautomation-0.7.2 spec/adapter/win_32/mouse_spec.rb