fusuma 2.0.3 → 2.2.0

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.
@@ -13,20 +13,24 @@ module Fusuma
13
13
  RSpec.describe Executor do
14
14
  before { @executor = Executor.new }
15
15
 
16
+ describe '#execute_key' do
17
+ it { expect { @executor.execute_keys }.to raise_error(NotImplementedError) }
18
+ end
19
+
16
20
  describe '#execute' do
17
- it do
18
- expect { @executor.execute('dummy') }.to raise_error(NotImplementedError)
19
- end
21
+ it { expect { @executor.execute('dummy') }.to raise_error(NotImplementedError) }
20
22
  end
21
23
 
22
24
  describe '#executable?' do
23
- it do
24
- expect { @executor.executable?('dummy') }.to raise_error(NotImplementedError)
25
- end
25
+ it { expect { @executor.executable?('dummy') }.to raise_error(NotImplementedError) }
26
26
  end
27
27
  end
28
28
 
29
29
  class DummyExecutor < Executor
30
+ def execute_keys
31
+ [:dummy]
32
+ end
33
+
30
34
  def execute(event)
31
35
  index = Config::Index.new([*event.record.index.keys, :dummy])
32
36
  content = Config.search(index)
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require './lib/fusuma/plugin/parsers/parser'
5
+ require './lib/fusuma/plugin/events/event'
6
+
7
+ module Fusuma
8
+ module Plugin
9
+ module Parsers
10
+ RSpec.describe LibinputGestureParser do
11
+ let(:parser) { LibinputGestureParser.new }
12
+
13
+ around do |example|
14
+ ConfigHelper.load_config_yml = <<~CONFIG
15
+ plugin:
16
+ parsers:
17
+ libinput_gesture_parser:
18
+ dummy: dummy
19
+ CONFIG
20
+
21
+ example.run
22
+
23
+ Config.custom_path = nil
24
+ end
25
+
26
+ describe '#source' do
27
+ subject { parser.source }
28
+
29
+ it { is_expected.to be LibinputGestureParser::DEFAULT_SOURCE }
30
+ end
31
+
32
+ describe '#parse' do
33
+ context 'with different tag(dummy) event' do
34
+ let(:event) { Events::Event.new(tag: 'dummy_input', record: 'dummy') }
35
+ it { expect(parser.parse(event).record).not_to be_a Events::Records::GestureRecord }
36
+ it { expect(parser.parse(event)).to eq event }
37
+ end
38
+
39
+ context 'with libinput_command_input event' do
40
+ let(:event) { Events::Event.new(tag: 'libinput_command_input', record: record) }
41
+ context 'with swipe gestures' do
42
+ # event10 GESTURE_SWIPE_BEGIN +0.728s 3
43
+ # event10 GESTURE_SWIPE_UPDATE +0.948s 3 0.23/ 0.00 ( 0.29/ 0.00 unaccelerated)
44
+ # event10 GESTURE_SWIPE_END +0.989s 3
45
+ let(:record) { 'event10 GESTURE_SWIPE_BEGIN +0.728s 3' }
46
+ it { expect(parser.parse(event).record).to be_a Events::Records::GestureRecord }
47
+ it { expect(parser.parse(event).record.status).to eq 'begin' }
48
+ end
49
+
50
+ context 'with hold gestures' do
51
+ # -event10 GESTURE_HOLD_BEGIN +2.125s 3
52
+ # event10 GESTURE_HOLD_END +3.274s 3
53
+ # event10 GESTURE_HOLD_BEGIN +5.573s 4
54
+ # event10 GESTURE_HOLD_END +6.462s 4 cancelled
55
+ context 'with begin' do
56
+ let(:record) { '-event10 GESTURE_HOLD_BEGIN +2.125s 3' }
57
+ it { expect(parser.parse(event).record).to be_a Events::Records::GestureRecord }
58
+ it { expect(parser.parse(event).record.status).to eq 'begin' }
59
+ end
60
+ context 'with end' do
61
+ let(:record) { ' event10 GESTURE_HOLD_END +3.274s 3' }
62
+ it { expect(parser.parse(event).record).to be_a Events::Records::GestureRecord }
63
+ it { expect(parser.parse(event).record.status).to eq 'end' }
64
+ end
65
+ context 'with end(cancelled)' do
66
+ let(:record) { ' event10 GESTURE_HOLD_END +6.462s 4 cancelled' }
67
+ it { expect(parser.parse(event).record).to be_a Events::Records::GestureRecord }
68
+ it { expect(parser.parse(event).record.status).to eq 'cancelled' }
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-20 00:00:00.000000000 Z
11
+ date: 2021-11-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
14
14
  on Linux able to recognize swipes or pinchs and assign command to them. Read installation
@@ -43,6 +43,7 @@ files:
43
43
  - lib/fusuma/plugin/buffers/gesture_buffer.rb
44
44
  - lib/fusuma/plugin/buffers/timer_buffer.rb
45
45
  - lib/fusuma/plugin/detectors/detector.rb
46
+ - lib/fusuma/plugin/detectors/hold_detector.rb
46
47
  - lib/fusuma/plugin/detectors/pinch_detector.rb
47
48
  - lib/fusuma/plugin/detectors/rotate_detector.rb
48
49
  - lib/fusuma/plugin/detectors/swipe_detector.rb
@@ -56,7 +57,6 @@ files:
56
57
  - lib/fusuma/plugin/executors/executor.rb
57
58
  - lib/fusuma/plugin/filters/filter.rb
58
59
  - lib/fusuma/plugin/filters/libinput_device_filter.rb
59
- - lib/fusuma/plugin/filters/libinput_timeout_filter.rb
60
60
  - lib/fusuma/plugin/inputs/input.rb
61
61
  - lib/fusuma/plugin/inputs/libinput_command_input.rb
62
62
  - lib/fusuma/plugin/inputs/timer_input.rb
@@ -84,6 +84,7 @@ files:
84
84
  - spec/lib/plugin/buffers/gesture_buffer_spec.rb
85
85
  - spec/lib/plugin/detectors/detector_spec.rb
86
86
  - spec/lib/plugin/detectors/dummy_detector.rb
87
+ - spec/lib/plugin/detectors/hold_detector_spec.rb
87
88
  - spec/lib/plugin/detectors/pinch_detector_spec.rb
88
89
  - spec/lib/plugin/detectors/rotate_detector_spec.rb
89
90
  - spec/lib/plugin/detectors/swipe_detector_spec.rb
@@ -99,14 +100,16 @@ files:
99
100
  - spec/lib/plugin/inputs/libinput_command_input_spec.rb
100
101
  - spec/lib/plugin/inputs/timer_input_spec.rb
101
102
  - spec/lib/plugin/manager_spec.rb
103
+ - spec/lib/plugin/parsers/libinput_gesture_parser_spec.rb
102
104
  - spec/lib/plugin/parsers/parser_spec.rb
103
105
  - spec/spec_helper.rb
104
106
  homepage: https://github.com/iberianpig/fusuma
105
107
  licenses:
106
108
  - MIT
107
109
  metadata:
110
+ rubygems_mfa_required: 'true'
108
111
  yard.run: yri
109
- post_install_message:
112
+ post_install_message:
110
113
  rdoc_options: []
111
114
  require_paths:
112
115
  - lib
@@ -121,44 +124,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
124
  - !ruby/object:Gem::Version
122
125
  version: '0'
123
126
  requirements: []
124
- rubygems_version: 3.1.4
125
- signing_key:
127
+ rubygems_version: 3.2.22
128
+ signing_key:
126
129
  specification_version: 4
127
130
  summary: Multitouch gestures with libinput driver, Linux
128
131
  test_files:
129
- - spec/lib/device_spec.rb
132
+ - spec/helpers/config_helper.rb
130
133
  - spec/lib/config/searcher_spec.rb
131
- - spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt
134
+ - spec/lib/config_spec.rb
135
+ - spec/lib/custom_process_spec.rb
136
+ - spec/lib/device_spec.rb
132
137
  - spec/lib/dummy_config.yml
138
+ - spec/lib/fusuma_spec.rb
139
+ - spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt
133
140
  - spec/lib/libinput-list-devices_magic_trackpad.txt
134
- - spec/lib/custom_process_spec.rb
141
+ - spec/lib/libinput-list-devices_razer_razer_blade.txt
142
+ - spec/lib/libinput-list-devices_thejinx0r.txt
143
+ - spec/lib/libinput-list-devices_unavailable.txt
144
+ - spec/lib/libinput_command_spec.rb
135
145
  - spec/lib/plugin/base_spec.rb
136
- - spec/lib/plugin/inputs/libinput_command_input_spec.rb
137
- - spec/lib/plugin/inputs/input_spec.rb
138
- - spec/lib/plugin/inputs/timer_input_spec.rb
139
- - spec/lib/plugin/events/records/record_spec.rb
146
+ - spec/lib/plugin/buffers/buffer_spec.rb
147
+ - spec/lib/plugin/buffers/dummy_buffer.rb
148
+ - spec/lib/plugin/buffers/gesture_buffer_spec.rb
149
+ - spec/lib/plugin/detectors/detector_spec.rb
150
+ - spec/lib/plugin/detectors/dummy_detector.rb
151
+ - spec/lib/plugin/detectors/hold_detector_spec.rb
152
+ - spec/lib/plugin/detectors/pinch_detector_spec.rb
153
+ - spec/lib/plugin/detectors/rotate_detector_spec.rb
154
+ - spec/lib/plugin/detectors/swipe_detector_spec.rb
155
+ - spec/lib/plugin/events/event_spec.rb
140
156
  - spec/lib/plugin/events/records/gesture_record_spec.rb
157
+ - spec/lib/plugin/events/records/record_spec.rb
141
158
  - spec/lib/plugin/events/records/text_record_spec.rb
142
- - spec/lib/plugin/events/event_spec.rb
143
- - spec/lib/plugin/filters/libinput_filter_spec.rb
159
+ - spec/lib/plugin/executors/command_executor_spec.rb
160
+ - spec/lib/plugin/executors/executor_spec.rb
144
161
  - spec/lib/plugin/filters/filter_spec.rb
145
- - spec/lib/plugin/detectors/detector_spec.rb
146
- - spec/lib/plugin/detectors/swipe_detector_spec.rb
147
- - spec/lib/plugin/detectors/rotate_detector_spec.rb
148
- - spec/lib/plugin/detectors/pinch_detector_spec.rb
149
- - spec/lib/plugin/detectors/dummy_detector.rb
162
+ - spec/lib/plugin/filters/libinput_filter_spec.rb
163
+ - spec/lib/plugin/inputs/input_spec.rb
164
+ - spec/lib/plugin/inputs/libinput_command_input_spec.rb
165
+ - spec/lib/plugin/inputs/timer_input_spec.rb
150
166
  - spec/lib/plugin/manager_spec.rb
151
- - spec/lib/plugin/buffers/dummy_buffer.rb
152
- - spec/lib/plugin/buffers/buffer_spec.rb
153
- - spec/lib/plugin/buffers/gesture_buffer_spec.rb
167
+ - spec/lib/plugin/parsers/libinput_gesture_parser_spec.rb
154
168
  - spec/lib/plugin/parsers/parser_spec.rb
155
- - spec/lib/plugin/executors/executor_spec.rb
156
- - spec/lib/plugin/executors/command_executor_spec.rb
157
- - spec/lib/libinput-list-devices_unavailable.txt
158
- - spec/lib/libinput_command_spec.rb
159
- - spec/lib/fusuma_spec.rb
160
- - spec/lib/libinput-list-devices_razer_razer_blade.txt
161
- - spec/lib/libinput-list-devices_thejinx0r.txt
162
- - spec/lib/config_spec.rb
163
- - spec/helpers/config_helper.rb
164
169
  - spec/spec_helper.rb
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './filter'
4
- require_relative '../../libinput_command'
5
-
6
- module Fusuma
7
- module Plugin
8
- module Filters
9
- # Filter device log
10
- class LibinputTimeoutFilter < Filter
11
- DEFAULT_SOURCE = 'libinput_command_input'
12
-
13
- # @return [TrueClass] when keeping it
14
- # @return [FalseClass] when discarding it
15
- def keep?(record)
16
- record.to_s == LibinputCommand::TIMEOUT_MESSAGE
17
- end
18
- end
19
- end
20
- end
21
- end