Sha256: 98e998449feaa07cb7595cc984b75326906d66fd2d5247086d94be744c57c134

Contents?: true

Size: 1.7 KB

Versions: 21

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe "Win32::Checkbox", :if => SpecHelper.adapter == :win_32 do
  it "#checkbox" do
    RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBox").should exist

    RAutomation::Window.wait_timeout = 0.1
    expect { RAutomation::Window.new(:title => "non-existing-window").checkbox(:value => "Something") }.
        to raise_exception(RAutomation::UnknownWindowException)
  end

  it "#set? & #set" do
    checkbox = RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBox")
    checkbox.should_not be_set

    checkbox.set
    checkbox.should be_set
  end

  it "#value" do
    checkbox = RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBox")
    checkbox.value.should == "checkBox"
  end

  it "#clear" do
    checkbox = RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBox")
    checkbox.set
    checkbox.should be_set

    checkbox.clear
    checkbox.should_not be_set
  end

  it "enabled/disabled" do
    RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBox").should be_enabled
    RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBox").should_not be_disabled

    RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBoxDisabled").should_not be_enabled
    RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBoxDisabled").should be_disabled
  end

  it "cannot check a disabled checkbox" do
    lambda {
      RAutomation::Window.new(:title => "MainFormWindow").checkbox(:value => "checkBoxDisabled").set
    }.should raise_error
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rautomation-0.7.0 spec/adapter/win_32/checkbox_spec.rb