File tree 3 files changed +26
-3
lines changed
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ Bug fixes:
6
+ * Properties containing Variants would return them doubly wrapped.
7
+
5
8
## Ruby D-Bus 0.18.0.beta4 - 2022-04-21
6
9
7
10
Bug fixes:
Original file line number Diff line number Diff line change @@ -282,8 +282,11 @@ def append(type, val)
282
282
283
283
def append_variant ( val )
284
284
vartype = nil
285
- if val . is_a? ( DBus ::Data ::Base )
286
- vartype = val . type # FIXME: box or unbox another variant?
285
+ if val . is_a? ( DBus ::Data ::Variant )
286
+ vartype = val . member_type
287
+ vardata = val . value
288
+ elsif val . is_a? ( DBus ::Data ::Base )
289
+ vartype = val . type
287
290
vardata = val . value
288
291
elsif val . is_a? ( Array ) && val . size == 2
289
292
case val [ 0 ]
Original file line number Diff line number Diff line change 163
163
end
164
164
end
165
165
166
- context "an dict-typed property" do
166
+ context "a dict-typed property" do
167
167
it "gets read as a hash" do
168
168
val = @iface [ "MyDict" ]
169
169
expect ( val ) . to eq ( {
172
172
"three" => [ 3 , 3 , 3 ]
173
173
} )
174
174
end
175
+
176
+ it "Get returns the correctly typed value (check with dbus-send)" do
177
+ cmd = "dbus-send --print-reply " \
178
+ "--dest=org.ruby.service " \
179
+ "/org/ruby/MyInstance " \
180
+ "org.freedesktop.DBus.Properties.Get " \
181
+ "string:org.ruby.SampleInterface " \
182
+ "string:MyDict"
183
+ reply = `#{ cmd } `
184
+ # a bug about variant nesting lead to a "variant variant int32 1" value
185
+ match_rx = /variant \s + array \s \[ \s +
186
+ dict \s entry\( \s +
187
+ string \s "one" \s +
188
+ variant \s + int32 \s 1 \s +
189
+ \) /x
190
+ expect ( reply ) . to match ( match_rx )
191
+ end
175
192
end
176
193
177
194
context "a variant-typed property" do
You can’t perform that action at this time.
0 commit comments