Sha256: ae050fd8cc2018c10f2d771e4ca0113333084ceea8e0ef75ab7f476ec2516d7e

Contents?: true

Size: 1.56 KB

Versions: 9

Compression:

Stored size: 1.56 KB

Contents

require_relative '../../helper'

Tk.init

describe Tk::Tile::Frame do
  Style = Tk::Tile::Style
  Frame = Tk::Tile::Frame

  it 'creates a new frame with layout_style' do
    layout_style = [
      'Button.button', {:children=>[
        'Button.focus', {:children=>[
          'Button.padding', {:children=>[
            'Button.label', {:expand=>true, :sticky=>''}
          ]}
        ]}
      ]}
    ]

    frame = Frame.new(Tk.root)
    frame.style(layout_style).should == true
  end

  it 'sets borderwidth default 0' do
    frame = Frame.new(Tk.root)
    frame.cget(:borderwidth).should == 0

    frame = Frame.new(Tk.root, borderwidth: 10)
    frame.cget(:borderwidth).should == 10

    frame.configure borderwidth: 20
    frame.cget(:borderwidth).should == 20
  end

  # One of the standard Tk border styles:
  # flat, groove, raised, ridge, solid, or sunken. Defaults to flat.
  it 'sets relief default :flat' do
    frame = Frame.new(Tk.root)
    frame.cget(:relief).should == :flat

    frame = Frame.new(Tk.root, relief: 'groove')
    frame.cget(:relief).should == :groove
  end

  it 'sets cursor' do
    frame = Frame.new(Tk.root)
    frame.cget(:cursor).should == nil

    lambda {
      Frame.new(Tk.root, cursor: '.s.s.s.s')
    }.should.raise RuntimeError
  end

  it 'sets additional padding to include inside the border' do
    frame = Frame.new(Tk.root)
    frame.cget(:padding).should == []

    frame = Frame.new(Tk.root, padding: 10)
    frame.cget(:padding).should == [ '10' ]

    frame.configure padding: [10, 20]
    frame.cget(:padding).should == ['10', '20']
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffi-tk-2010.08.23 spec/ffi-tk/tile/frame.rb
ffi-tk-2010.08 spec/ffi-tk/tile/frame.rb
ffi-tk-2010.06 spec/ffi-tk/tile/frame.rb
ffi-tk-2010.03 spec/ffi-tk/tile/frame.rb
ffi-tk-2010.02 spec/ffi-tk/tile/frame.rb
ffi-tk-2010.01 spec/ffi-tk/tile/frame.rb
ffi-tk-2010.01.02 spec/ffi-tk/tile/frame.rb
ffi-tk-2009.12.14 spec/ffi-tk/tile/frame.rb
ffi-tk-2009.11.29 spec/ffi-tk/tile/frame.rb