uh 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9999e12b354d336f1ce29125beee2449b14605a7
4
- data.tar.gz: 49554e1f41407b9a7a80b2f620858668783fde85
3
+ metadata.gz: 1ef1227406e129065ec58d3ccbef8e530c74050f
4
+ data.tar.gz: 3fb7f59ba3e5c3853a0e5c0f488b031b0ce5362f
5
5
  SHA512:
6
- metadata.gz: ee9bc0537a9451c13d48a68f1f3fea3ed4eeb1e881cfb6a9faf801285883425aaa94ebc2e94d79484939c6eef68b382a913d0fe356ef0f243c16cf5313538ceb
7
- data.tar.gz: e967087ea493695022b163eb560905dd7ca74e6b6a1bf69d73b4422db9910a9cb403c03a1bca860861c3813c71008d26f04e1bf5171396fd3a17338c78f0a904
6
+ metadata.gz: 5898495c89370be4a3e77478bf49fc944051677aae34e38d653afe7a7012a9fc2276298de8ee77052b89566d1759724c16c4082582128d6be34ba305f53fd72c
7
+ data.tar.gz: 942d61b82d905b2bef029bd551db2709770b58a9ef4a308068d186a2e3b1aedadcf1bdecf3767be911c97bd7c83ba210734ac91313c18b4425b9d0d654fb84a8
data/lib/uh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Uh
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
data/lib/uh/wm/client.rb CHANGED
@@ -66,7 +66,7 @@ module Uh
66
66
  if window.icccm_wm_protocols.include? :WM_DELETE_WINDOW
67
67
  window.icccm_wm_delete
68
68
  else
69
- window.kill!
69
+ window.kill
70
70
  end
71
71
  self
72
72
  end
data/test/test_helper.rb CHANGED
@@ -10,4 +10,10 @@ class Minitest::Test
10
10
  #parallelize_me!
11
11
  end
12
12
 
13
+ class Minitest::Spec
14
+ class << self
15
+ alias context describe
16
+ end
17
+ end
18
+
13
19
  Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
@@ -0,0 +1,173 @@
1
+ require 'ostruct'
2
+ require 'test_helper'
3
+ require 'uh/wm'
4
+
5
+ module Uh
6
+ class WM
7
+ describe Client do
8
+ let(:geo) { Geo.new(0, 0, 1024, 768) }
9
+ let(:window) { OpenStruct.new(name: 'win name', wclass: 'win class') }
10
+ subject { Client.new(window) }
11
+
12
+ before { subject.geo = geo }
13
+
14
+ it 'is hidden' do
15
+ assert subject.hidden?
16
+ end
17
+
18
+ describe '#name' do
19
+ it 'returns the window name' do
20
+ assert_equal 'win name', subject.name
21
+ end
22
+ end
23
+
24
+ describe '#wclass' do
25
+ it 'returns the window class' do
26
+ assert_equal 'win class', subject.wclass
27
+ end
28
+ end
29
+
30
+ describe '#update_window_properties' do
31
+ it 'updates the window name' do
32
+ window.name = 'new name'
33
+ assert_equal 'new name', subject.name
34
+ end
35
+
36
+ it 'updates the window class' do
37
+ window.wclass = 'new class'
38
+ assert_equal 'new class', subject.wclass
39
+ end
40
+ end
41
+
42
+ describe '#configure' do
43
+ let(:window) { Minitest::Mock.new }
44
+
45
+ before { window.expect :configure, window, [geo] }
46
+
47
+ it 'configures the window with client geo' do
48
+ subject.configure
49
+ window.verify
50
+ end
51
+
52
+ it 'returns self' do
53
+ assert_same subject, subject.configure
54
+ end
55
+ end
56
+
57
+ describe '#moveresize' do
58
+ let(:window) { Minitest::Mock.new }
59
+
60
+ before { window.expect :moveresize, window, [geo] }
61
+ it 'moveresizes the window with client geo' do
62
+ subject.moveresize
63
+ window.verify
64
+ end
65
+
66
+ it 'returns self' do
67
+ assert_same subject, subject.moveresize
68
+ end
69
+ end
70
+
71
+ describe '#show' do
72
+ let(:window) { Minitest::Mock.new }
73
+
74
+ before { window.expect :map, window }
75
+
76
+ it 'maps the window' do
77
+ subject.show
78
+ window.verify
79
+ end
80
+
81
+ it 'is not hidden anymore' do
82
+ subject.show
83
+ refute subject.hidden?
84
+ end
85
+
86
+ it 'returns self' do
87
+ assert_same subject, subject.show
88
+ end
89
+ end
90
+
91
+ describe '#hide' do
92
+ let(:window) { Minitest::Mock.new }
93
+
94
+ before { window.expect :unmap, window }
95
+
96
+ it 'unmaps the window' do
97
+ subject.hide
98
+ window.verify
99
+ end
100
+
101
+ it 'is stays hidden' do
102
+ subject.hide
103
+ assert subject.hidden?
104
+ end
105
+
106
+ it 'returns self' do
107
+ assert_same subject, subject.hide
108
+ end
109
+ end
110
+
111
+ describe '#focus' do
112
+ let(:window) { Minitest::Mock.new }
113
+
114
+ before do
115
+ window.expect :raise, window
116
+ window.expect :focus, window
117
+ end
118
+
119
+ it 'raises and focuses the window' do
120
+ subject.focus
121
+ window.verify
122
+ end
123
+
124
+ it 'returns self' do
125
+ assert_same subject, subject.focus
126
+ end
127
+ end
128
+
129
+ describe '#kill' do
130
+ let(:window) { Minitest::Mock.new }
131
+ let(:protocols) { [] }
132
+
133
+ before { window.expect :icccm_wm_protocols, protocols }
134
+
135
+ it 'kills the window' do
136
+ window.expect :kill, window
137
+ subject.kill
138
+ window.verify
139
+ end
140
+
141
+ it 'returns self' do
142
+ window.expect :kill, window
143
+ assert_same subject, subject.kill
144
+ end
145
+
146
+ context 'when window supports icccm wm delete' do
147
+ let(:protocols) { [:WM_DELETE_WINDOW] }
148
+
149
+ it 'icccm deletes the window' do
150
+ window.expect :icccm_wm_delete, window
151
+ subject.kill
152
+ window.verify
153
+ end
154
+ end
155
+ end
156
+
157
+ describe '#kill!' do
158
+ let(:window) { Minitest::Mock.new }
159
+
160
+ before { window.expect :kill, window }
161
+
162
+ it 'kills the window' do
163
+ subject.kill!
164
+ window.verify
165
+ end
166
+
167
+ it 'returns self' do
168
+ assert_same subject, subject.kill!
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -109,6 +109,7 @@ files:
109
109
  - test/test_helper.rb
110
110
  - test/uh/test_geo.rb
111
111
  - test/uh/test_wm.rb
112
+ - test/uh/wm/test_client.rb
112
113
  - uh.gemspec
113
114
  homepage: https://rubygems.org/gems/uh
114
115
  licenses: []
@@ -137,4 +138,5 @@ test_files:
137
138
  - test/test_helper.rb
138
139
  - test/uh/test_geo.rb
139
140
  - test/uh/test_wm.rb
141
+ - test/uh/wm/test_client.rb
140
142
  has_rdoc: