Sha256: 21fc6b8f34bdbdcbc271cffbb02178f85518ec9cbaa284052294f6c9a8cef536
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
shared_examples_for 'enhanced awt component' do after(:each) { @component.dispose if @component.respond_to? :dispose } context 'new with common options' do it 'is possible to create this component with settable attribute' do # p described_class.attributes component_attributes = { :background => Awt::Color.new(1, 2, 3), :foreground => Awt::Color.new(3, 2, 1), :cursor => Awt::Cursor.new(Awt::Cursor::HAND_CURSOR), :enabled => false, :visible => false, :font => Awt::Font.new("Trebuchet", Awt::Font::PLAIN, 11), :layout => (defined?(layout) ? layout : Awt::FlowLayout.new), :location => Awt::Point.new(10, 20), :size => Awt::Dimension.new(300, 300), :name => 'Blah', } @component = described_class.new *(new_args.push component_attributes) component_attributes.each do |name, value| @component.send(name).should == value end end end context 'new with parent' do unless described_class == Swing::JFrame || described_class == Swing::JMenuBar it 'is possible to set parent via options' do parent = Swing::JPanel.new @component = described_class.new *(new_args.push :parent => parent) @component.parent.should == parent end end end end shared_examples_for 'tool tipped component' do it 'is possible to set :tool_tip_text attribute' do @component = described_class.new *(new_args.push :tool_tip_text => 'Blah') @component.tool_tip_text.should == 'Blah' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
swing-0.1.8 | spec/swing/shared.rb |
swing-0.1.7 | spec/swing/shared.rb |