File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55describe "PropertyTest" do
66 before ( :each ) do
77 session_bus = DBus ::ASessionBus . new
8- svc = session_bus . service ( "org.ruby.service" )
9- @obj = svc . object ( "/org/ruby/MyInstance" )
8+ @ svc = session_bus . service ( "org.ruby.service" )
9+ @obj = @ svc. object ( "/org/ruby/MyInstance" )
1010 @obj . introspect
1111 @iface = @obj [ "org.ruby.SampleInterface" ]
1212 end
1515 expect ( @iface [ "ReadMe" ] ) . to eq ( "READ ME" )
1616 end
1717
18+ it "tests property reading on a V1 object" do
19+ obj = @svc [ "/org/ruby/MyInstance" ]
20+ obj . introspect
21+ iface = obj [ "org.ruby.SampleInterface" ]
22+
23+ expect ( iface [ "ReadMe" ] ) . to eq ( "READ ME" )
24+ end
25+
1826 it "tests property nonreading" do
1927 expect { @iface [ "WriteMe" ] } . to raise_error ( DBus ::Error , /not readable/ )
2028 end
4351 expect ( all . keys . sort ) . to eq ( [ "ReadMe" , "ReadOrWriteMe" ] )
4452 end
4553
54+ it "tests get all on a V1 object" do
55+ obj = @svc [ "/org/ruby/MyInstance" ]
56+ obj . introspect
57+ iface = obj [ "org.ruby.SampleInterface" ]
58+
59+ all = iface . all_properties
60+ expect ( all . keys . sort ) . to eq ( [ "ReadMe" , "ReadOrWriteMe" ] )
61+ end
62+
4663 it "tests unknown property reading" do
4764 expect { @iface [ "Spoon" ] } . to raise_error ( DBus ::Error , /not found/ )
4865 end
Original file line number Diff line number Diff line change 66describe "ValueTest" do
77 before ( :each ) do
88 session_bus = DBus ::ASessionBus . new
9- svc = session_bus . service ( "org.ruby.service" )
10- @obj = svc . object ( "/org/ruby/MyInstance" )
9+ @ svc = session_bus . service ( "org.ruby.service" )
10+ @obj = @ svc. object ( "/org/ruby/MyInstance" )
1111 @obj . introspect # necessary
1212 @obj . default_iface = "org.ruby.SampleInterface"
1313 end
3636 empty_hash = { }
3737 expect ( @obj . bounce_variant ( empty_hash ) [ 0 ] ) . to eq ( empty_hash )
3838 end
39-
39+
40+ it "retrieves a single return value with API V1" do
41+ obj = @svc [ "/org/ruby/MyInstance" ]
42+ obj . introspect
43+ obj . default_iface = "org.ruby.SampleInterface"
44+
45+ expect ( obj . bounce_variant ( "cuckoo" ) ) . to eq ( "cuckoo" )
46+ expect ( obj . bounce_variant ( [ "coucou" , "kuku" ] ) ) . to eq ( [ "coucou" , "kuku" ] )
47+ expect ( obj . bounce_variant ( [ ] ) ) . to eq ( [ ] )
48+ empty_hash = { }
49+ expect ( obj . bounce_variant ( empty_hash ) ) . to eq ( empty_hash )
50+ end
51+
4052 # these are ambiguous
4153 it "tests pairs with a string" do
4254
You can’t perform that action at this time.
0 commit comments