qml 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +46 -0
- data/.rspec +2 -0
- data/.travis.yml +15 -0
- data/.yardopts +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +351 -0
- data/Rakefile +6 -0
- data/examples/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/examples/fizzbuzz/fizzbuzz.rb +43 -0
- data/examples/fizzbuzz/main.qml +38 -0
- data/examples/imageprovider/imageprovider.rb +57 -0
- data/examples/imageprovider/main.qml +51 -0
- data/examples/todo/main.qml +70 -0
- data/examples/todo/todo.rb +36 -0
- data/examples/twitter/main.qml +36 -0
- data/examples/twitter/twitter.rb +55 -0
- data/ext/qml/accessclass.cpp +71 -0
- data/ext/qml/accessclass.h +19 -0
- data/ext/qml/accessobject.cpp +30 -0
- data/ext/qml/accessobject.h +22 -0
- data/ext/qml/application.cpp +54 -0
- data/ext/qml/application.h +17 -0
- data/ext/qml/common.h +18 -0
- data/ext/qml/ext_accesssupport.cpp +77 -0
- data/ext/qml/ext_accesssupport.h +42 -0
- data/ext/qml/ext_gcmarker.cpp +39 -0
- data/ext/qml/ext_gcmarker.h +27 -0
- data/ext/qml/ext_kernel.cpp +62 -0
- data/ext/qml/ext_kernel.h +11 -0
- data/ext/qml/ext_metaobject.cpp +410 -0
- data/ext/qml/ext_metaobject.h +62 -0
- data/ext/qml/ext_pluginloader.cpp +55 -0
- data/ext/qml/ext_pluginloader.h +32 -0
- data/ext/qml/ext_pointer.cpp +134 -0
- data/ext/qml/ext_pointer.h +43 -0
- data/ext/qml/ext_testutil.cpp +42 -0
- data/ext/qml/ext_testutil.h +11 -0
- data/ext/qml/extconf.rb +84 -0
- data/ext/qml/foreignclass.cpp +72 -0
- data/ext/qml/foreignclass.h +88 -0
- data/ext/qml/foreignmetaobject.cpp +345 -0
- data/ext/qml/foreignmetaobject.h +46 -0
- data/ext/qml/foreignobject.cpp +22 -0
- data/ext/qml/foreignobject.h +21 -0
- data/ext/qml/functioninfo.h +16 -0
- data/ext/qml/init.cpp +69 -0
- data/ext/qml/listmodel.cpp +112 -0
- data/ext/qml/listmodel.h +43 -0
- data/ext/qml/markable.h +12 -0
- data/ext/qml/objectdata.cpp +26 -0
- data/ext/qml/objectdata.h +20 -0
- data/ext/qml/objectgc.cpp +69 -0
- data/ext/qml/objectgc.h +28 -0
- data/ext/qml/plugins/core/applicationextension.cpp +34 -0
- data/ext/qml/plugins/core/applicationextension.h +28 -0
- data/ext/qml/plugins/core/componentextension.cpp +41 -0
- data/ext/qml/plugins/core/componentextension.h +28 -0
- data/ext/qml/plugins/core/contextextension.cpp +39 -0
- data/ext/qml/plugins/core/contextextension.h +29 -0
- data/ext/qml/plugins/core/core.pro +29 -0
- data/ext/qml/plugins/core/coreplugin.cpp +87 -0
- data/ext/qml/plugins/core/coreplugin.h +49 -0
- data/ext/qml/plugins/core/engineextension.cpp +27 -0
- data/ext/qml/plugins/core/engineextension.h +28 -0
- data/ext/qml/plugins/core/imageprovider.cpp +38 -0
- data/ext/qml/plugins/core/imageprovider.h +18 -0
- data/ext/qml/plugins/core/imagerequestpromise.cpp +19 -0
- data/ext/qml/plugins/core/imagerequestpromise.h +21 -0
- data/ext/qml/plugins/core/qmlexception.cpp +11 -0
- data/ext/qml/plugins/core/qmlexception.h +17 -0
- data/ext/qml/plugins/testutil/objectlifechecker.cpp +17 -0
- data/ext/qml/plugins/testutil/objectlifechecker.h +24 -0
- data/ext/qml/plugins/testutil/ownershiptest.cpp +26 -0
- data/ext/qml/plugins/testutil/ownershiptest.h +30 -0
- data/ext/qml/plugins/testutil/testobject.cpp +6 -0
- data/ext/qml/plugins/testutil/testobject.h +108 -0
- data/ext/qml/plugins/testutil/testobjectsubclass.cpp +10 -0
- data/ext/qml/plugins/testutil/testobjectsubclass.h +19 -0
- data/ext/qml/plugins/testutil/testutil.pro +20 -0
- data/ext/qml/plugins/testutil/testutilplugin.cpp +47 -0
- data/ext/qml/plugins/testutil/testutilplugin.h +32 -0
- data/ext/qml/qmltyperegisterer.cpp +74 -0
- data/ext/qml/qmltyperegisterer.h +30 -0
- data/ext/qml/rubyclass.cpp +94 -0
- data/ext/qml/rubyclass.h +234 -0
- data/ext/qml/rubyvalue.cpp +690 -0
- data/ext/qml/rubyvalue.h +256 -0
- data/ext/qml/signalforwarder.cpp +66 -0
- data/ext/qml/signalforwarder.h +29 -0
- data/ext/qml/util.cpp +120 -0
- data/ext/qml/util.h +101 -0
- data/ext/qml/valuereference.cpp +50 -0
- data/ext/qml/valuereference.h +22 -0
- data/ext/qml/weakvaluereference.cpp +27 -0
- data/ext/qml/weakvaluereference.h +19 -0
- data/lib/qml.rb +41 -0
- data/lib/qml/access.rb +137 -0
- data/lib/qml/application.rb +139 -0
- data/lib/qml/class_builder.rb +126 -0
- data/lib/qml/component.rb +53 -0
- data/lib/qml/context.rb +71 -0
- data/lib/qml/data.rb +2 -0
- data/lib/qml/data/array_model.rb +103 -0
- data/lib/qml/data/error.rb +5 -0
- data/lib/qml/data/list_model.rb +146 -0
- data/lib/qml/dispatchable.rb +34 -0
- data/lib/qml/dispatcher.rb +61 -0
- data/lib/qml/engine.rb +54 -0
- data/lib/qml/error_converter.rb +15 -0
- data/lib/qml/errors.rb +26 -0
- data/lib/qml/geometry.rb +3 -0
- data/lib/qml/geometry/point.rb +5 -0
- data/lib/qml/geometry/rectangle.rb +5 -0
- data/lib/qml/geometry/size.rb +5 -0
- data/lib/qml/image_provider.rb +87 -0
- data/lib/qml/meta_object.rb +20 -0
- data/lib/qml/models.rb +1 -0
- data/lib/qml/name_helper.rb +12 -0
- data/lib/qml/platform.rb +15 -0
- data/lib/qml/plugin_loader.rb +46 -0
- data/lib/qml/plugins.rb +26 -0
- data/lib/qml/qml.rb +1 -0
- data/lib/qml/qt.rb +6 -0
- data/lib/qml/qt_classes.rb +9 -0
- data/lib/qml/qt_object_base.rb +108 -0
- data/lib/qml/reactive.rb +8 -0
- data/lib/qml/reactive/bindable.rb +79 -0
- data/lib/qml/reactive/chained_signal.rb +25 -0
- data/lib/qml/reactive/error.rb +5 -0
- data/lib/qml/reactive/object.rb +278 -0
- data/lib/qml/reactive/property.rb +19 -0
- data/lib/qml/reactive/signal.rb +116 -0
- data/lib/qml/reactive/signal_spy.rb +27 -0
- data/lib/qml/reactive/signals/map_signal.rb +21 -0
- data/lib/qml/reactive/signals/merge_signal.rb +21 -0
- data/lib/qml/reactive/signals/select_signal.rb +21 -0
- data/lib/qml/reactive/simple_property.rb +17 -0
- data/lib/qml/reactive/unbound_property.rb +42 -0
- data/lib/qml/reactive/unbound_signal.rb +51 -0
- data/lib/qml/root_path.rb +3 -0
- data/lib/qml/test_util.rb +1 -0
- data/lib/qml/test_util/object_life_checker.rb +17 -0
- data/lib/qml/version.rb +3 -0
- data/lib/qml/wrappable.rb +9 -0
- data/qml.gemspec +28 -0
- data/spec/assets/testobj.qml +5 -0
- data/spec/qml/.access_spec.rb.swp +0 -0
- data/spec/qml/access_spec.rb +162 -0
- data/spec/qml/application_spec.rb +43 -0
- data/spec/qml/component_spec.rb +44 -0
- data/spec/qml/context_spec.rb +43 -0
- data/spec/qml/conversion_spec.rb +59 -0
- data/spec/qml/data/array_model_spec.rb +215 -0
- data/spec/qml/dispatchable_spec.rb +26 -0
- data/spec/qml/dispatcher_spec.rb +48 -0
- data/spec/qml/geometry/point_spec.rb +4 -0
- data/spec/qml/geometry/rectangle_spec.rb +4 -0
- data/spec/qml/geometry/size_spec.rb +4 -0
- data/spec/qml/plugin_loader_spec.rb +33 -0
- data/spec/qml/qt_object_base_spec.rb +119 -0
- data/spec/qml/reactive/object_spec.rb +273 -0
- data/spec/qml/reactive/property_spec.rb +70 -0
- data/spec/qml/reactive/signal_spec.rb +191 -0
- data/spec/qml/reactive/signal_spy_spec.rb +26 -0
- data/spec/qml/test_object_spec.rb +186 -0
- data/spec/qml_spec.rb +7 -0
- data/spec/spec_helper.rb +5 -0
- metadata +321 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe QML::Reactive::Signal do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@signal = QML::Reactive::Signal.new(:foo, :bar)
|
7
|
+
@variadic_signal = QML::Reactive::Signal.new(variadic: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'connection' do
|
11
|
+
|
12
|
+
describe '#connect, #emit' do
|
13
|
+
|
14
|
+
context 'when non-variadic' do
|
15
|
+
|
16
|
+
before do
|
17
|
+
@signal.connect { |foo, bar| @received = [foo, bar] }
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'connects a block and calls it' do
|
21
|
+
@signal.emit('apple', 'orange')
|
22
|
+
expect(@received).to eq(['apple', 'orange'])
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when the number of arguments is wrong' do
|
26
|
+
it 'fails with an ArgumentError' do
|
27
|
+
expect { @signal.emit('apple') }.to raise_error(ArgumentError)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'when variadic' do
|
33
|
+
|
34
|
+
it 'connects a block and calls it' do
|
35
|
+
received = nil
|
36
|
+
@variadic_signal.connect { |foo, bar| received = [foo, bar] }
|
37
|
+
@variadic_signal.emit('apple', 'orange')
|
38
|
+
expect(received).to eq(['apple', 'orange'])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'calls connected blocks in the order they have been conncted' do
|
43
|
+
received = []
|
44
|
+
@signal.connect { received << 'first' }
|
45
|
+
@signal.connect { received << 'second' }
|
46
|
+
@signal.emit('foo', 'bar')
|
47
|
+
expect(received).to eq(['first', 'second'])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#each' do
|
52
|
+
it 'is an alias of #connect' do
|
53
|
+
expect(@signal.method(:each)).to eq @signal.method(:connect)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '::Connection#disconnect' do
|
58
|
+
|
59
|
+
it 'disconnects the connection' do
|
60
|
+
connection = @signal.connect { |foo, bar| @received = foo + bar }
|
61
|
+
@signal.emit('apple', 'orange')
|
62
|
+
connection.disconnect
|
63
|
+
@signal.emit('banana', 'grape')
|
64
|
+
expect(@received).to eq('appleorange')
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'disconnects the whole chained connections if possible' do
|
68
|
+
signal = QML::Reactive::Signal.new :arg
|
69
|
+
mapped = signal.map { |arg| arg * 2 }
|
70
|
+
|
71
|
+
connection = mapped.connect {}
|
72
|
+
|
73
|
+
connection.disconnect
|
74
|
+
expect(signal.connection_count).to eq(0)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#connection_count' do
|
79
|
+
it 'returns the number of connections' do
|
80
|
+
prc1 = ->(foo, bar) {}
|
81
|
+
prc2 = ->(foo, bar) {}
|
82
|
+
@signal.connect(&prc1)
|
83
|
+
@signal.connect(&prc2)
|
84
|
+
expect(@signal.connection_count).to eq(2)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe 'attributes' do
|
90
|
+
|
91
|
+
describe '#arity' do
|
92
|
+
|
93
|
+
context 'when non-variadic' do
|
94
|
+
it 'returns the number of arguments' do
|
95
|
+
expect(@signal.arity).to eq(2)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when variadic' do
|
100
|
+
it 'returns the number of arguments' do
|
101
|
+
expect(@variadic_signal.arity).to eq(-1)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#parameters' do
|
107
|
+
|
108
|
+
context 'when non-variadic' do
|
109
|
+
it 'returns the parameter information' do
|
110
|
+
expect(@signal.parameters).to eq([[:req, :foo], [:req, :bar]])
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'when variadic' do
|
115
|
+
it 'returns the parameter information' do
|
116
|
+
expect(@variadic_signal.parameters).to eq([[:rest, :args]])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe 'alternatives for #emit' do
|
123
|
+
|
124
|
+
before do
|
125
|
+
@signal.connect { |foo, bar| @received = foo + bar }
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#to_proc' do
|
129
|
+
it 'returns a Proc that emits the original signal' do
|
130
|
+
prc = @signal.to_proc
|
131
|
+
prc.call('foo', 'bar')
|
132
|
+
expect(prc).to be_a(Proc)
|
133
|
+
expect(@received).to eq('foobar')
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe '#[]' do
|
138
|
+
it 'is an alias of #emit' do
|
139
|
+
@signal["some", "text"]
|
140
|
+
expect(@received).to eq("sometext")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe '#call' do
|
145
|
+
it 'is an alias of #emit' do
|
146
|
+
@signal.call("some", "text")
|
147
|
+
expect(@received).to eq("sometext")
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe 'transformations' do
|
153
|
+
|
154
|
+
describe '#map' do
|
155
|
+
it 'returns another Signal that transforms the original signal parameters' do
|
156
|
+
received = nil
|
157
|
+
@signal
|
158
|
+
.map { |foo, bar| foo * bar }
|
159
|
+
.connect { |arg| received = arg }
|
160
|
+
@signal.emit(20, 30)
|
161
|
+
expect(received).to eq(600)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe '#select' do
|
166
|
+
it 'returns another Signal which is filtered by the given block' do
|
167
|
+
count = 0
|
168
|
+
@signal.select { |foo| foo % 2 == 0 } .connect { count += 1 }
|
169
|
+
10.times { |i| @signal.emit(i, i) }
|
170
|
+
expect(count).to eq(5)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#merge' do
|
175
|
+
it 'merges multiple signals' do
|
176
|
+
received = []
|
177
|
+
|
178
|
+
signal = QML::Reactive::Signal.new :foo
|
179
|
+
signal2 = QML::Reactive::Signal.new :foo
|
180
|
+
signal.merge(signal2).connect { |foo| received << foo }
|
181
|
+
|
182
|
+
signal.emit(:one)
|
183
|
+
signal2.emit(:two)
|
184
|
+
signal.emit(:three)
|
185
|
+
expect(received).to eq([:one, :two, :three])
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe QML::Reactive::SignalSpy do
|
4
|
+
|
5
|
+
it 'records signal emittion' do
|
6
|
+
signal = QML::Reactive::Signal.new(:arg1, :arg2)
|
7
|
+
spy = QML::Reactive::SignalSpy.new(signal)
|
8
|
+
signal.emit(10, 20)
|
9
|
+
signal.emit('foo', 'bar')
|
10
|
+
expect(spy.args).to eq([[10, 20], ['foo', 'bar']])
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
describe QML::Reactive::Signal do
|
16
|
+
|
17
|
+
describe '#spy' do
|
18
|
+
it 'returns a SignalSpy for the signal' do
|
19
|
+
signal = QML::Reactive::Signal.new(:arg1, :arg2)
|
20
|
+
spy = signal.spy
|
21
|
+
signal.emit(10, 20)
|
22
|
+
signal.emit('foo', 'bar')
|
23
|
+
expect(spy.args).to eq([[10, 20], ['foo', 'bar']])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "test object" do
|
4
|
+
|
5
|
+
let(:plugin) { QML::Plugins.test_util }
|
6
|
+
let(:obj) { plugin.createTestObject }
|
7
|
+
|
8
|
+
describe '#normalMethod' do
|
9
|
+
|
10
|
+
it 'should call the method' do
|
11
|
+
expect(obj.normalMethod(1, "23")).to eq(24)
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'if the arguments are not convertible' do
|
15
|
+
it 'should raise error' do
|
16
|
+
expect { obj.normalMethod([1, 2], 'bar') }.to raise_error QML::MethodError
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'if the number of arguments is wrong' do
|
21
|
+
it 'should raise error' do
|
22
|
+
expect { obj.normalMethod(1) }.to raise_error QML::MethodError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#normal_method' do
|
28
|
+
it 'is same as #normalMethod' do
|
29
|
+
expect(obj.normalMethod(1, "23")).to eq(24)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#variantMethod' do
|
34
|
+
|
35
|
+
it 'should call the method with QVariant arguments' do
|
36
|
+
expect(obj.variantMethod(20, [1, 3, 4, 9])).to eq(37)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#overloadedMethod' do
|
41
|
+
|
42
|
+
it 'should call the method with the same arity' do
|
43
|
+
expect(obj.overloadedMethod('foo', 1)).to eq('2 params')
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when multiple methods with the same arity are provided' do
|
47
|
+
|
48
|
+
it 'should call the method defined last' do
|
49
|
+
expect(obj.overloadedMethod('hoge')).to eq('last')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#someSignal signal' do
|
55
|
+
|
56
|
+
it 'should emit the signal' do
|
57
|
+
spy = QML::Reactive::SignalSpy.new(obj.someSignal)
|
58
|
+
obj.emitSomeSignal('poyopoyo')
|
59
|
+
expect(spy.args.first).to eq(['poyopoyo'])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#some_signal signal' do
|
64
|
+
|
65
|
+
it 'is same as #someSignal' do
|
66
|
+
spy = QML::Reactive::SignalSpy.new(obj.some_signal)
|
67
|
+
obj.emit_some_signal('poyopoyo')
|
68
|
+
expect(spy.args.first).to eq(['poyopoyo'])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#throwingMethod' do
|
73
|
+
it 'raises a QML::CxxError' do
|
74
|
+
expect { obj.throwingMethod }.to raise_error(QML::CppError, "<std::runtime_error> test error")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#metaObjectMethod' do
|
79
|
+
it 'returns the QML::MetaObject of the test object' do
|
80
|
+
expect(obj.metaObjectMethod).to eq obj.class.meta_object
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#selfReturningMethod' do
|
85
|
+
it 'returns the same Ruby object' do
|
86
|
+
expect(obj.selfReturningMethod).to be obj
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#name property' do
|
91
|
+
|
92
|
+
it 'should be set' do
|
93
|
+
obj.name = 'abcd'
|
94
|
+
expect(obj.getName).to eq('abcd')
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should notify when changed' do
|
98
|
+
spy = QML::Reactive::SignalSpy.new(obj.name_changed)
|
99
|
+
obj.name = 'hogepoyo'
|
100
|
+
expect(spy.args.first).to eq(['hogepoyo'])
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'with wrong type' do
|
104
|
+
|
105
|
+
it 'raise error' do
|
106
|
+
expect { obj.name = 123 }.to raise_error QML::PropertyError
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe '#someValue property' do
|
112
|
+
context 'as #some_value' do
|
113
|
+
it 'can be set and get' do
|
114
|
+
obj.some_value = 123
|
115
|
+
expect(obj.some_value).to eq 123
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'enums' do
|
121
|
+
|
122
|
+
it 'should be set' do
|
123
|
+
k = obj.class
|
124
|
+
expect(k::Foo).to eq(0)
|
125
|
+
expect(k::Bar).to eq(1)
|
126
|
+
expect(k::FooBar).to eq(2)
|
127
|
+
expect(k::FOO_BAR).to eq(2)
|
128
|
+
expect(k::Enums).to match_array [0,1,2]
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'can be set and get' do
|
132
|
+
obj.enum_value = obj.class::FOO_BAR
|
133
|
+
expect(obj.enum_value).to eq(obj.class::FOO_BAR)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe 'QtObjectBase#inspect' do
|
138
|
+
it 'inspects the class name and property values' do
|
139
|
+
expect(obj.inspect).to eq %{#<[class for RubyQml::TestObject]:#{obj.__id__} enumValue=0 name="" objectName="" someValue=0.0>}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'in subclass' do
|
144
|
+
let(:subobj) { plugin.createTestObject }
|
145
|
+
it "can call TestObject's method" do
|
146
|
+
expect(subobj.normalMethod(1, "23")).to eq(24)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context 'in non-main threads' do
|
151
|
+
|
152
|
+
require 'celluloid'
|
153
|
+
|
154
|
+
class TestCaller
|
155
|
+
include Celluloid
|
156
|
+
|
157
|
+
def initialize(obj)
|
158
|
+
@obj = obj
|
159
|
+
end
|
160
|
+
|
161
|
+
def call(method, *args)
|
162
|
+
@obj.public_send(method, *args)
|
163
|
+
rescue => e
|
164
|
+
e
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
let(:test_caller) { TestCaller.new(obj) }
|
169
|
+
|
170
|
+
describe '#normal_method' do
|
171
|
+
it 'fails' do
|
172
|
+
expect(test_caller.call(:normal_method, 1, "23")).to be_a QML::InvalidThreadError
|
173
|
+
end
|
174
|
+
end
|
175
|
+
describe '#name' do
|
176
|
+
it 'fails' do
|
177
|
+
expect(test_caller.call(:name)).to be_a QML::InvalidThreadError
|
178
|
+
end
|
179
|
+
end
|
180
|
+
describe '#name=' do
|
181
|
+
it 'fails' do
|
182
|
+
expect(test_caller.call(:name=, "hoge")).to be_a QML::InvalidThreadError
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
data/spec/qml_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,321 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: qml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryohei Ikegami
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: celluloid
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: twitter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: ruby-qml provides bindings between QML and Ruby and enables you to use
|
98
|
+
Qt Quick-based GUI from Ruby.
|
99
|
+
email:
|
100
|
+
- iofg2100@gmail.com
|
101
|
+
executables: []
|
102
|
+
extensions:
|
103
|
+
- ext/qml/extconf.rb
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- .gitignore
|
107
|
+
- .rspec
|
108
|
+
- .travis.yml
|
109
|
+
- .yardopts
|
110
|
+
- Gemfile
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- examples/assets/fonts/fontawesome-webfont.ttf
|
115
|
+
- examples/fizzbuzz/fizzbuzz.rb
|
116
|
+
- examples/fizzbuzz/main.qml
|
117
|
+
- examples/imageprovider/imageprovider.rb
|
118
|
+
- examples/imageprovider/main.qml
|
119
|
+
- examples/todo/main.qml
|
120
|
+
- examples/todo/todo.rb
|
121
|
+
- examples/twitter/main.qml
|
122
|
+
- examples/twitter/twitter.rb
|
123
|
+
- ext/qml/accessclass.cpp
|
124
|
+
- ext/qml/accessclass.h
|
125
|
+
- ext/qml/accessobject.cpp
|
126
|
+
- ext/qml/accessobject.h
|
127
|
+
- ext/qml/application.cpp
|
128
|
+
- ext/qml/application.h
|
129
|
+
- ext/qml/common.h
|
130
|
+
- ext/qml/ext_accesssupport.cpp
|
131
|
+
- ext/qml/ext_accesssupport.h
|
132
|
+
- ext/qml/ext_gcmarker.cpp
|
133
|
+
- ext/qml/ext_gcmarker.h
|
134
|
+
- ext/qml/ext_kernel.cpp
|
135
|
+
- ext/qml/ext_kernel.h
|
136
|
+
- ext/qml/ext_metaobject.cpp
|
137
|
+
- ext/qml/ext_metaobject.h
|
138
|
+
- ext/qml/ext_pluginloader.cpp
|
139
|
+
- ext/qml/ext_pluginloader.h
|
140
|
+
- ext/qml/ext_pointer.cpp
|
141
|
+
- ext/qml/ext_pointer.h
|
142
|
+
- ext/qml/ext_testutil.cpp
|
143
|
+
- ext/qml/ext_testutil.h
|
144
|
+
- ext/qml/extconf.rb
|
145
|
+
- ext/qml/foreignclass.cpp
|
146
|
+
- ext/qml/foreignclass.h
|
147
|
+
- ext/qml/foreignmetaobject.cpp
|
148
|
+
- ext/qml/foreignmetaobject.h
|
149
|
+
- ext/qml/foreignobject.cpp
|
150
|
+
- ext/qml/foreignobject.h
|
151
|
+
- ext/qml/functioninfo.h
|
152
|
+
- ext/qml/init.cpp
|
153
|
+
- ext/qml/listmodel.cpp
|
154
|
+
- ext/qml/listmodel.h
|
155
|
+
- ext/qml/markable.h
|
156
|
+
- ext/qml/objectdata.cpp
|
157
|
+
- ext/qml/objectdata.h
|
158
|
+
- ext/qml/objectgc.cpp
|
159
|
+
- ext/qml/objectgc.h
|
160
|
+
- ext/qml/plugins/core/applicationextension.cpp
|
161
|
+
- ext/qml/plugins/core/applicationextension.h
|
162
|
+
- ext/qml/plugins/core/componentextension.cpp
|
163
|
+
- ext/qml/plugins/core/componentextension.h
|
164
|
+
- ext/qml/plugins/core/contextextension.cpp
|
165
|
+
- ext/qml/plugins/core/contextextension.h
|
166
|
+
- ext/qml/plugins/core/core.pro
|
167
|
+
- ext/qml/plugins/core/coreplugin.cpp
|
168
|
+
- ext/qml/plugins/core/coreplugin.h
|
169
|
+
- ext/qml/plugins/core/engineextension.cpp
|
170
|
+
- ext/qml/plugins/core/engineextension.h
|
171
|
+
- ext/qml/plugins/core/imageprovider.cpp
|
172
|
+
- ext/qml/plugins/core/imageprovider.h
|
173
|
+
- ext/qml/plugins/core/imagerequestpromise.cpp
|
174
|
+
- ext/qml/plugins/core/imagerequestpromise.h
|
175
|
+
- ext/qml/plugins/core/qmlexception.cpp
|
176
|
+
- ext/qml/plugins/core/qmlexception.h
|
177
|
+
- ext/qml/plugins/testutil/objectlifechecker.cpp
|
178
|
+
- ext/qml/plugins/testutil/objectlifechecker.h
|
179
|
+
- ext/qml/plugins/testutil/ownershiptest.cpp
|
180
|
+
- ext/qml/plugins/testutil/ownershiptest.h
|
181
|
+
- ext/qml/plugins/testutil/testobject.cpp
|
182
|
+
- ext/qml/plugins/testutil/testobject.h
|
183
|
+
- ext/qml/plugins/testutil/testobjectsubclass.cpp
|
184
|
+
- ext/qml/plugins/testutil/testobjectsubclass.h
|
185
|
+
- ext/qml/plugins/testutil/testutil.pro
|
186
|
+
- ext/qml/plugins/testutil/testutilplugin.cpp
|
187
|
+
- ext/qml/plugins/testutil/testutilplugin.h
|
188
|
+
- ext/qml/qmltyperegisterer.cpp
|
189
|
+
- ext/qml/qmltyperegisterer.h
|
190
|
+
- ext/qml/rubyclass.cpp
|
191
|
+
- ext/qml/rubyclass.h
|
192
|
+
- ext/qml/rubyvalue.cpp
|
193
|
+
- ext/qml/rubyvalue.h
|
194
|
+
- ext/qml/signalforwarder.cpp
|
195
|
+
- ext/qml/signalforwarder.h
|
196
|
+
- ext/qml/util.cpp
|
197
|
+
- ext/qml/util.h
|
198
|
+
- ext/qml/valuereference.cpp
|
199
|
+
- ext/qml/valuereference.h
|
200
|
+
- ext/qml/weakvaluereference.cpp
|
201
|
+
- ext/qml/weakvaluereference.h
|
202
|
+
- lib/qml.rb
|
203
|
+
- lib/qml/access.rb
|
204
|
+
- lib/qml/application.rb
|
205
|
+
- lib/qml/class_builder.rb
|
206
|
+
- lib/qml/component.rb
|
207
|
+
- lib/qml/context.rb
|
208
|
+
- lib/qml/data.rb
|
209
|
+
- lib/qml/data/array_model.rb
|
210
|
+
- lib/qml/data/error.rb
|
211
|
+
- lib/qml/data/list_model.rb
|
212
|
+
- lib/qml/dispatchable.rb
|
213
|
+
- lib/qml/dispatcher.rb
|
214
|
+
- lib/qml/engine.rb
|
215
|
+
- lib/qml/error_converter.rb
|
216
|
+
- lib/qml/errors.rb
|
217
|
+
- lib/qml/geometry.rb
|
218
|
+
- lib/qml/geometry/point.rb
|
219
|
+
- lib/qml/geometry/rectangle.rb
|
220
|
+
- lib/qml/geometry/size.rb
|
221
|
+
- lib/qml/image_provider.rb
|
222
|
+
- lib/qml/meta_object.rb
|
223
|
+
- lib/qml/models.rb
|
224
|
+
- lib/qml/name_helper.rb
|
225
|
+
- lib/qml/platform.rb
|
226
|
+
- lib/qml/plugin_loader.rb
|
227
|
+
- lib/qml/plugins.rb
|
228
|
+
- lib/qml/qml.rb
|
229
|
+
- lib/qml/qt.rb
|
230
|
+
- lib/qml/qt_classes.rb
|
231
|
+
- lib/qml/qt_object_base.rb
|
232
|
+
- lib/qml/reactive.rb
|
233
|
+
- lib/qml/reactive/bindable.rb
|
234
|
+
- lib/qml/reactive/chained_signal.rb
|
235
|
+
- lib/qml/reactive/error.rb
|
236
|
+
- lib/qml/reactive/object.rb
|
237
|
+
- lib/qml/reactive/property.rb
|
238
|
+
- lib/qml/reactive/signal.rb
|
239
|
+
- lib/qml/reactive/signal_spy.rb
|
240
|
+
- lib/qml/reactive/signals/map_signal.rb
|
241
|
+
- lib/qml/reactive/signals/merge_signal.rb
|
242
|
+
- lib/qml/reactive/signals/select_signal.rb
|
243
|
+
- lib/qml/reactive/simple_property.rb
|
244
|
+
- lib/qml/reactive/unbound_property.rb
|
245
|
+
- lib/qml/reactive/unbound_signal.rb
|
246
|
+
- lib/qml/root_path.rb
|
247
|
+
- lib/qml/test_util.rb
|
248
|
+
- lib/qml/test_util/object_life_checker.rb
|
249
|
+
- lib/qml/version.rb
|
250
|
+
- lib/qml/wrappable.rb
|
251
|
+
- qml.gemspec
|
252
|
+
- spec/assets/testobj.qml
|
253
|
+
- spec/qml/.access_spec.rb.swp
|
254
|
+
- spec/qml/access_spec.rb
|
255
|
+
- spec/qml/application_spec.rb
|
256
|
+
- spec/qml/component_spec.rb
|
257
|
+
- spec/qml/context_spec.rb
|
258
|
+
- spec/qml/conversion_spec.rb
|
259
|
+
- spec/qml/data/array_model_spec.rb
|
260
|
+
- spec/qml/dispatchable_spec.rb
|
261
|
+
- spec/qml/dispatcher_spec.rb
|
262
|
+
- spec/qml/geometry/point_spec.rb
|
263
|
+
- spec/qml/geometry/rectangle_spec.rb
|
264
|
+
- spec/qml/geometry/size_spec.rb
|
265
|
+
- spec/qml/plugin_loader_spec.rb
|
266
|
+
- spec/qml/qt_object_base_spec.rb
|
267
|
+
- spec/qml/reactive/object_spec.rb
|
268
|
+
- spec/qml/reactive/property_spec.rb
|
269
|
+
- spec/qml/reactive/signal_spec.rb
|
270
|
+
- spec/qml/reactive/signal_spy_spec.rb
|
271
|
+
- spec/qml/test_object_spec.rb
|
272
|
+
- spec/qml_spec.rb
|
273
|
+
- spec/spec_helper.rb
|
274
|
+
homepage: https://github.com/seanchas116/ruby-qml
|
275
|
+
licenses:
|
276
|
+
- MIT
|
277
|
+
metadata: {}
|
278
|
+
post_install_message:
|
279
|
+
rdoc_options: []
|
280
|
+
require_paths:
|
281
|
+
- lib
|
282
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
283
|
+
requirements:
|
284
|
+
- - '>='
|
285
|
+
- !ruby/object:Gem::Version
|
286
|
+
version: '0'
|
287
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - '>='
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '0'
|
292
|
+
requirements: []
|
293
|
+
rubyforge_project:
|
294
|
+
rubygems_version: 2.0.14
|
295
|
+
signing_key:
|
296
|
+
specification_version: 4
|
297
|
+
summary: A QML / Qt Quick wrapper for Ruby
|
298
|
+
test_files:
|
299
|
+
- spec/assets/testobj.qml
|
300
|
+
- spec/qml/.access_spec.rb.swp
|
301
|
+
- spec/qml/access_spec.rb
|
302
|
+
- spec/qml/application_spec.rb
|
303
|
+
- spec/qml/component_spec.rb
|
304
|
+
- spec/qml/context_spec.rb
|
305
|
+
- spec/qml/conversion_spec.rb
|
306
|
+
- spec/qml/data/array_model_spec.rb
|
307
|
+
- spec/qml/dispatchable_spec.rb
|
308
|
+
- spec/qml/dispatcher_spec.rb
|
309
|
+
- spec/qml/geometry/point_spec.rb
|
310
|
+
- spec/qml/geometry/rectangle_spec.rb
|
311
|
+
- spec/qml/geometry/size_spec.rb
|
312
|
+
- spec/qml/plugin_loader_spec.rb
|
313
|
+
- spec/qml/qt_object_base_spec.rb
|
314
|
+
- spec/qml/reactive/object_spec.rb
|
315
|
+
- spec/qml/reactive/property_spec.rb
|
316
|
+
- spec/qml/reactive/signal_spec.rb
|
317
|
+
- spec/qml/reactive/signal_spy_spec.rb
|
318
|
+
- spec/qml/test_object_spec.rb
|
319
|
+
- spec/qml_spec.rb
|
320
|
+
- spec/spec_helper.rb
|
321
|
+
has_rdoc:
|