uh-layout 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c12d5f1f5d194450159e0d830f3ed574f3a6334
4
- data.tar.gz: 63432f78d31078399ddc9a83d3e4021d9739f033
3
+ metadata.gz: 586dbaf6dde99169879ab4e52b8f9b5553aeb5cf
4
+ data.tar.gz: f029cc9a50ce9848c20fe22f54bf6e7c5e4f846a
5
5
  SHA512:
6
- metadata.gz: 254059d976bc47da8974ebf8d3b611b6bba615b2bfe361af2726f23606fc85e5181b322c08d2821a84e5721e9c90b52fd0ba935c9397e71d20a1aa4d00b4495d
7
- data.tar.gz: e69b1862080d58d023fe2f1ed4c74fe9685213250a58bc1af26433c9f34bdc2a28227b68c7b94e93d5724241205264056c8516c3c2e4be8ec03f9f7e914ceb34
6
+ metadata.gz: 05c787214555dcea902301c0b720e2e6681080ed923881b688fd9eaf90bfc7cfaae2f3348e94efe0f2e07735df5788389be2c8b9ba635253f3fe8da5817ac7c3
7
+ data.tar.gz: ddbece19dfd6d6379bdff86426ec662871ea4521c84b07f9e2c0377d713b52cac2e2b34c075891b57c4b17e1a9c097efa9574bb61a8316cdd8d1c823ee03611d
@@ -1,5 +1,5 @@
1
1
  module Uh
2
2
  class Layout
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uh-layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
@@ -58,14 +58,6 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
- - ".gitignore"
62
- - ".rspec"
63
- - ".travis.yml"
64
- - Gemfile
65
- - Guardfile
66
- - LICENSE
67
- - README.md
68
- - Rakefile
69
61
  - lib/uh/layout.rb
70
62
  - lib/uh/layout/arrangers/fixed_width.rb
71
63
  - lib/uh/layout/arrangers/stack.rb
@@ -80,20 +72,6 @@ files:
80
72
  - lib/uh/layout/screen.rb
81
73
  - lib/uh/layout/tag.rb
82
74
  - lib/uh/layout/version.rb
83
- - spec/spec_helper.rb
84
- - spec/support/factories.rb
85
- - spec/uh/layout/arrangers/fixed_width_spec.rb
86
- - spec/uh/layout/arrangers/stack_spec.rb
87
- - spec/uh/layout/arrangers/vert_tile_spec.rb
88
- - spec/uh/layout/client_column_mover_spec.rb
89
- - spec/uh/layout/column_spec.rb
90
- - spec/uh/layout/container_spec.rb
91
- - spec/uh/layout/history_spec.rb
92
- - spec/uh/layout/registrant_spec.rb
93
- - spec/uh/layout/screen_spec.rb
94
- - spec/uh/layout/tag_spec.rb
95
- - spec/uh/layout_spec.rb
96
- - uh-layout.gemspec
97
75
  homepage: https://rubygems.org/gems/uh-layout
98
76
  licenses:
99
77
  - BSD-3-Clause
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- /Gemfile-custom.rb
2
- /Gemfile.lock
3
- /tmp/
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.2
6
- - 2.1
7
- - ruby-head
8
- - rbx-2
9
- matrix:
10
- fast_finish: true
11
- allow_failures:
12
- - rvm:
13
- - ruby-head
14
- - rbx-2
15
- notifications:
16
- email:
17
- - tj+travis_uh_layout@a13.fr
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- eval File.read('Gemfile-custom.rb') if File.exist?('Gemfile-custom.rb')
data/Guardfile DELETED
@@ -1,6 +0,0 @@
1
- guard :rspec, cmd: 'bundle exec rspec' do
2
- watch(%r{\Aspec/.+_spec\.rb\z})
3
- watch(%r{\Alib/(.+)\.rb\z}) { |m| "spec/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { 'spec' }
5
- watch(%r{\Aspec/support/.+\.rb\z}) { 'spec' }
6
- end
data/LICENSE DELETED
@@ -1,30 +0,0 @@
1
- Copyright 2014 Thibault Jouan. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
6
-
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright
11
- notice, this list of conditions and the following disclaimer in
12
- the documentation and/or other materials provided with the
13
- distribution.
14
-
15
- * Neither the name of the software nor the names of its contributors
16
- may be used to endorse or promote products derived from this
17
- software without specific prior written permission.
18
-
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND
21
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS
24
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27
- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30
- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md DELETED
@@ -1,18 +0,0 @@
1
- uh-layout
2
- =========
3
-
4
- [![Version ][badge-version-img]][badge-version-uri]
5
- [![Build status ][badge-build-img]][badge-build-uri]
6
- [![Code Climate ][badge-cclimate-img]][badge-cclimate-uri]
7
-
8
-
9
- Tiling and stacking layout for `uh-wm` ruby gem.
10
-
11
-
12
-
13
- [badge-version-img]: https://img.shields.io/gem/v/uh-layout.svg?style=flat-square
14
- [badge-version-uri]: https://rubygems.org/gems/uh-layout
15
- [badge-build-img]: https://img.shields.io/travis/tjouan/uh-layout/master.svg?style=flat-square
16
- [badge-build-uri]: https://travis-ci.org/tjouan/uh-layout
17
- [badge-cclimate-img]: https://img.shields.io/codeclimate/github/tjouan/uh-layout.svg?style=flat-square
18
- [badge-cclimate-uri]: https://codeclimate.com/github/tjouan/uh-layout
data/Rakefile DELETED
@@ -1,5 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- task default: :spec
4
-
5
- RSpec::Core::RakeTask.new(:spec)
data/spec/spec_helper.rb DELETED
@@ -1,16 +0,0 @@
1
- require 'uh'
2
- require 'uh/wm'
3
- require 'uh/layout'
4
-
5
- Dir['spec/support/**/*.rb'].map { |e| require e.gsub 'spec/', '' }
6
-
7
- RSpec::Matchers.define_negated_matcher :not_be, :be
8
-
9
- RSpec.configure do |config|
10
- config.include Factories
11
-
12
- config.mock_with :rspec do |mocks|
13
- mocks.verify_doubled_constant_names = true
14
- mocks.verify_partial_doubles = true
15
- end
16
- end
@@ -1,23 +0,0 @@
1
- module Factories
2
- class Entry
3
- include Uh::GeoAccessors
4
-
5
- attr_accessor :geo
6
-
7
- def initialize(geo)
8
- @geo = geo
9
- end
10
- end
11
-
12
- def build_client
13
- Uh::WM::Client.new(instance_spy Uh::Window)
14
- end
15
-
16
- def build_entry(geo = build_geo)
17
- Entry.new(geo)
18
- end
19
-
20
- def build_geo(x = 0, y = 0, width = 640, height = 480)
21
- Uh::Geo.new(x, y, width, height)
22
- end
23
- end
@@ -1,72 +0,0 @@
1
- module Uh
2
- class Layout
3
- module Arrangers
4
- describe FixedWidth do
5
- let(:geo) { build_geo 20, 0, 640, 480 }
6
- let(:entry) { build_entry }
7
- let(:entries) { Container.new([entry, build_entry]) }
8
- subject(:arranger) { described_class.new entries, geo, width: 300 }
9
-
10
- describe '#arrange' do
11
- it 'decreases first entry width as the optimal width' do
12
- arranger.arrange
13
- expect(entries[0].width).to eq 300
14
- end
15
-
16
- it 'offsets entries with given geo' do
17
- arranger.arrange
18
- expect(entries[0].x).to eq 20
19
- end
20
-
21
- it 'moves second entry aside the first entry' do
22
- arranger.arrange
23
- expect(entries[1].x).to eq 320
24
- end
25
-
26
- it 'increases last entry width to occupy remaining width' do
27
- arranger.arrange
28
- expect(entries[1].width).to eq 340
29
- end
30
-
31
- it 'copies given geo y' do
32
- entries[0].y = nil
33
- arranger.arrange
34
- expect(entries[0].y).to eq 0
35
- end
36
-
37
- it 'copies given geo height' do
38
- entries[0].height = nil
39
- arranger.arrange
40
- expect(entries[0].height).to eq 480
41
- end
42
-
43
- context 'without entry' do
44
- let(:entries) { Container.new([]) }
45
-
46
- it 'does not raise any error' do
47
- expect { arranger.arrange }.not_to raise_error
48
- end
49
- end
50
- end
51
-
52
- describe '#max_count?' do
53
- context 'when a new entry fits in current geo' do
54
- let(:entries) { Container.new([entry]) }
55
-
56
- it 'returns false' do
57
- expect(arranger.max_count?).to be false
58
- end
59
- end
60
-
61
- context 'when current geo can not contain more entry' do
62
- let(:entries) { Container.new([entry, entry.dup]) }
63
-
64
- it 'returns true' do
65
- expect(arranger.max_count?).to be true
66
- end
67
- end
68
- end
69
- end
70
- end
71
- end
72
- end
@@ -1,42 +0,0 @@
1
- module Uh
2
- class Layout
3
- module Arrangers
4
- describe Stack do
5
- let(:entry) { build_entry }
6
- let(:other_entry) { build_entry }
7
- let(:entries) { Container.new([entry, other_entry]) }
8
- let(:geo) { build_geo 0, 0, 300, 480 }
9
- subject(:arranger) { described_class.new entries, geo }
10
-
11
- describe '#arrange' do
12
- it 'sets given geo on all entries' do
13
- arranger.arrange
14
- expect(entries.map(&:geo)).to all eq geo
15
- end
16
- end
17
-
18
- describe '#each_visible' do
19
- it 'yields current entry' do
20
- expect { |b| arranger.each_visible &b }
21
- .to yield_successive_args entry
22
- end
23
-
24
- context 'with no current entry' do
25
- let(:entries) { Container.new([]) }
26
-
27
- it 'does not yield' do
28
- expect { |b| arranger.each_visible &b }.not_to yield_control
29
- end
30
- end
31
- end
32
-
33
- describe '#each_hidden' do
34
- it 'yields all entries except current one' do
35
- expect { |b| arranger.each_hidden &b }
36
- .to yield_successive_args other_entry
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,49 +0,0 @@
1
- module Uh
2
- class Layout
3
- module Arrangers
4
- describe VertTile do
5
- let(:entry) { build_entry }
6
- let(:other_entry) { build_entry }
7
- let(:entries) { Container.new([entry, other_entry]) }
8
- let(:geo) { build_geo 0, 0, 300, 480 }
9
- subject(:arranger) { described_class.new entries, geo }
10
-
11
- describe '#arrange' do
12
- it 'sets x offset from given geo on all entries' do
13
- arranger.arrange
14
- expect(entries.map(&:x)).to all eq 0
15
- end
16
-
17
- it 'sets width from given geo on all entries' do
18
- arranger.arrange
19
- expect(entries.map(&:width)).to all eq 300
20
- end
21
-
22
- it 'splits entries height equally' do
23
- arranger.arrange
24
- expect(entries.map(&:height)).to all eq 239
25
- end
26
-
27
- it 'adds a margin between entries' do
28
- arranger.arrange
29
- expect(entries[1].y - entries[0].height - entries[0].y).to eq 1
30
- end
31
- end
32
-
33
- describe '#each_visible' do
34
- it 'yields all entries' do
35
- expect { |b| arranger.each_visible &b }
36
- .to yield_successive_args entry, other_entry
37
- end
38
- end
39
-
40
- describe '#each_hidden' do
41
- it 'yields no entry' do
42
- expect { |b| arranger.each_hidden &b }.not_to yield_control
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
49
-
@@ -1,96 +0,0 @@
1
- module Uh
2
- class Layout
3
- describe ClientColumnMover do
4
- let(:client) { build_client }
5
- let(:column) { Column.new(build_geo) }
6
- let(:columns) { Container.new([column]) }
7
- let(:columns_max_count) { false }
8
- subject(:mover) { described_class.new columns, columns_max_count }
9
-
10
- describe '#move_current' do
11
- shared_examples 'moves current client' do |expected_column_index|
12
- it 'removes current client from origin column' do
13
- mover.move_current :succ
14
- expect(column).not_to include client
15
- end
16
-
17
- it 'adds current client in the destination column' do
18
- mover.move_current :succ
19
- expect(columns[expected_column_index]).to include client
20
- end
21
-
22
- it 'updates destination column as the current one' do
23
- mover.move_current :succ
24
- expect(columns.current).to be columns[expected_column_index]
25
- end
26
-
27
- it 'preserves current client as the current one' do
28
- expect { mover.move_current :succ }
29
- .not_to change { columns.current.current_client }
30
- end
31
- end
32
-
33
- context 'given one column with one client' do
34
- before { column << client }
35
-
36
- include_examples 'moves current client', 1
37
- end
38
-
39
- context 'given one column with many clients' do
40
- before { column << client << client.dup }
41
-
42
- include_examples 'moves current client', 1
43
- end
44
-
45
- context 'given two columns' do
46
- let(:columns) { Container.new([column, Column.new(build_geo)]) }
47
-
48
- before { columns[1] << client.dup }
49
-
50
- context 'when origin column has many clients' do
51
- before { column << client << client.dup }
52
-
53
- include_examples 'moves current client', 1
54
- end
55
-
56
- context 'when origin column has one client' do
57
- before { column << client }
58
-
59
- include_examples 'moves current client', 1
60
- end
61
- end
62
- end
63
-
64
- describe '#get_or_create_column' do
65
- let(:columns) { Container.new([column, Column.new(build_geo)]) }
66
-
67
- it 'returns the consecutive column in given direction' do
68
- expect(mover.get_or_create_column :succ).to be columns[1]
69
- end
70
-
71
- context 'when current column is last in given direction' do
72
- before { columns.current = columns[1] }
73
-
74
- context 'when max columns count is not reached' do
75
- it 'appends a new column' do
76
- expect(mover.get_or_create_column :succ).to be columns[2]
77
- end
78
-
79
- it 'prepends a new column' do
80
- columns.current = columns[0]
81
- expect(mover.get_or_create_column :pred).to be columns[0]
82
- end
83
- end
84
-
85
- context 'when max columns count is reached' do
86
- let(:columns_max_count) { true }
87
-
88
- it 'returns the consecutive column in given direction' do
89
- expect(mover.get_or_create_column :succ).to be columns[0]
90
- end
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
@@ -1,137 +0,0 @@
1
- module Uh
2
- class Layout
3
- describe Column do
4
- let(:geo) { build_geo }
5
- let(:other_geo) { build_geo 640, 0, 320, 240 }
6
- let(:mode) { :stack }
7
- let(:client) { build_client }
8
- let(:other_client) { build_client }
9
- subject(:column) { described_class.new geo, mode: mode }
10
-
11
- it 'has a copy to given geo' do
12
- expect(column.geo).to eq(geo).and not_be geo
13
- end
14
-
15
- it 'has no client assigned' do
16
- expect(column).to be_empty
17
- end
18
-
19
- it 'has :stack as default mode' do
20
- expect(column.mode).to be :stack
21
- end
22
-
23
- describe '#<<' do
24
- before { column << client }
25
-
26
- it 'adds given client' do
27
- expect(column.clients).to include client
28
- end
29
-
30
- it 'adds given client after current one' do
31
- column << other_client
32
- column.current_client = client
33
- column << new_client = build_client
34
- expect(column.clients.to_a).to eq [client, new_client, other_client]
35
- end
36
-
37
- it 'assigns column geo copy to given client' do
38
- expect(client.geo).to eq(column.geo).and not_be column.geo
39
- end
40
-
41
- it 'returns self' do
42
- expect(column << client).to be column
43
- end
44
- end
45
-
46
- describe '#mode_toggle' do
47
- it 'toggles mode from stack to tile' do
48
- expect { column.mode_toggle }
49
- .to change { column.mode }.from(:stack).to(:tile)
50
- end
51
-
52
- it 'toggles mode from tile to stack' do
53
- column.mode_toggle
54
- expect { column.mode_toggle }
55
- .to change { column.mode }.from(:tile).to(:stack)
56
- end
57
-
58
- end
59
-
60
- describe '#arranger' do
61
- context 'when column mode is stack' do
62
- it 'returns a stack arranger' do
63
- expect(column.arranger).to be_an Arrangers::Stack
64
- end
65
- end
66
-
67
- context 'when column mode is tile' do
68
- it 'returns a vertical tile arranger' do
69
- column.mode_toggle
70
- expect(column.arranger).to be_an Arrangers::VertTile
71
- end
72
- end
73
- end
74
-
75
- describe '#client_swap' do
76
- before { column << client << other_client }
77
-
78
- it 'sends #set message to clients with given direction' do
79
- expect(column.clients).to receive(:set).with :pred
80
- column.client_swap :pred
81
- end
82
-
83
- context 'when column mode is tile' do
84
- let(:mode) { :tile }
85
-
86
- it 'arranges current column clients' do
87
- expect(column).to receive :arrange_clients
88
- column.client_swap :pred
89
- end
90
-
91
- it 'shows and hides clients in current column' do
92
- expect(column).to receive :show_hide_clients
93
- column.client_swap :pred
94
- end
95
- end
96
- end
97
-
98
- describe '#arrange_clients' do
99
- before { column << client << other_client }
100
-
101
- it 'arranges clients' do
102
- arranger = instance_spy Arrangers::Stack
103
- allow(column).to receive(:arranger) { arranger }
104
- expect(arranger).to receive :arrange
105
- column.arrange_clients
106
- end
107
-
108
- it 'moveresizes clients' do
109
- expect([client, other_client]).to all receive :moveresize
110
- column.arrange_clients
111
- end
112
- end
113
-
114
- describe '#show_hide_clients' do
115
- let(:arranger) { double 'arranger', each_visible: nil, each_hidden: nil }
116
-
117
- it 'shows visible clients when they are hidden' do
118
- allow(arranger).to receive(:each_visible)
119
- .and_yield(client.hide)
120
- .and_yield(other_client.show)
121
- expect(client).to receive :show
122
- expect(other_client).not_to receive :show
123
- column.show_hide_clients arranger: arranger
124
- end
125
-
126
- it 'hides hidden clients except those already hidden' do
127
- allow(arranger).to receive(:each_hidden)
128
- .and_yield(client.show)
129
- .and_yield(other_client.hide)
130
- expect(client).to receive :hide
131
- expect(other_client).not_to receive :hide
132
- column.show_hide_clients arranger: arranger
133
- end
134
- end
135
- end
136
- end
137
- end