Skip to content

Commit

Permalink
borderless --> border: false
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed Mar 16, 2016
1 parent fe3df18 commit d9565f9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
4 changes: 2 additions & 2 deletions samples/simple-borderless.rb
@@ -1,3 +1,3 @@
Shoes.app borderless: true do
Shoes.app border: false do
title "Look, no borders!"
end
end
11 changes: 7 additions & 4 deletions shoes-core/lib/shoes/internal_app.rb
Expand Up @@ -13,10 +13,13 @@ class InternalApp

extend Forwardable

DEFAULT_OPTIONS = { width: 600,
height: 500,
title: "Shoes 4",
resizable: true }.freeze
DEFAULT_OPTIONS = {
width: 600,
height: 500,
title: "Shoes 4",
resizable: true,
border: true
}.freeze

def initialize(app, opts, &blk)
@app = app
Expand Down
2 changes: 1 addition & 1 deletion shoes-swt/lib/shoes/swt/app.rb
Expand Up @@ -200,7 +200,7 @@ def main_window_style
style |= ::Swt::SWT::RESIZE | ::Swt::SWT::MAX if @dsl.opts[:resizable]
style |= ::Swt::SWT::APPLICATION_MODAL if @dsl.opts[:modal]
style |= ::Swt::SWT::ON_TOP if @dsl.opts[:always_on_top]
style |= ::Swt::SWT::NO_TRIM if @dsl.opts[:borderless]
style |= ::Swt::SWT::NO_TRIM unless @dsl.opts.fetch(:border, true)
style
end

Expand Down
32 changes: 16 additions & 16 deletions shoes-swt/spec/shoes/swt/app_spec.rb
Expand Up @@ -2,17 +2,11 @@

describe Shoes::Swt::App do
let(:opts) { {background: Shoes::COLORS[:salmon], resizable: true} }
let(:app) { double('app') }
let(:dsl) { double('dsl', app: app,
opts: opts,
width: width,
height: 0,
app_title: 'double') }
let(:width) {0}
let(:dsl) { dsl_app_with_opts(opts) }
let(:app) {double 'app' }

let(:swt_salmon) { }

subject { Shoes::Swt::App.new(dsl) }
subject { described_class.new dsl }

it { is_expected.to respond_to :clipboard }
it { is_expected.to respond_to :clipboard= }
Expand Down Expand Up @@ -73,12 +67,12 @@
end

it "should return a bitmask that represents always being on top" do
always_on_top = app_with_opts always_on_top: true
always_on_top = app_with_opts always_on_top: true, resizable: false
expect(always_on_top.send(:main_window_style)).to eq(BASE_BITMASK | Swt::SWT::ON_TOP)
end

it "should return an bitmask that indicates no trim" do
no_border = app_with_opts(borderless: true)
no_border = app_with_opts(border: false, resizable: false)
expect(no_border.send(:main_window_style)).to eq(BASE_BITMASK | Swt::SWT::NO_TRIM)
end
end
Expand Down Expand Up @@ -155,12 +149,18 @@
end

def app_with_opts(opts)
dsl_app_double = double('app',
opts: opts,
width: 0,
height: 0,
app_title: 'double')
dsl_app_double = dsl_app_with_opts(opts)

Shoes::Swt::App.new dsl_app_double
end

def dsl_app_with_opts(opts)
double('app',
app: app,
opts: Shoes::InternalApp::DEFAULT_OPTIONS.merge(opts),
width: 0,
height: 0,
app_title: 'double')
end

end

0 comments on commit d9565f9

Please sign in to comment.