summaryrefslogtreecommitdiff
path: root/org
diff options
context:
space:
mode:
authorMatthew Johnson <mjj29@qadesh.matthew.ath.cx>2009-11-01 10:45:26 +0000
committerMatthew Johnson <mjj29@qadesh.matthew.ath.cx>2009-11-01 10:45:26 +0000
commit37e82d7d7ed71d24f1f316becaaa913f7bd43431 (patch)
tree36943c8f1e655ae35a2749c7fb31b8dbd843919a /org
parent26611dabfea24bd4b51617c14d7f939c609c5260 (diff)
add regression test for structs in maps in signals
Diffstat (limited to 'org')
-rw-r--r--org/freedesktop/dbus/test/TestSignalInterface.java6
-rw-r--r--org/freedesktop/dbus/test/test.java13
2 files changed, 16 insertions, 3 deletions
diff --git a/org/freedesktop/dbus/test/TestSignalInterface.java b/org/freedesktop/dbus/test/TestSignalInterface.java
index 1032ec1..406ce36 100644
--- a/org/freedesktop/dbus/test/TestSignalInterface.java
+++ b/org/freedesktop/dbus/test/TestSignalInterface.java
@@ -62,10 +62,12 @@ public interface TestSignalInterface extends DBusInterface
public static class TestArraySignal extends DBusSignal
{
public final List<TestStruct2> v;
- public TestArraySignal(String path, List<TestStruct2> v) throws DBusException
+ public final Map<UInt32, TestStruct2> m;
+ public TestArraySignal(String path, List<TestStruct2> v, Map<UInt32, TestStruct2> m) throws DBusException
{
- super(path, v);
+ super(path, v, m);
this.v = v;
+ this.m = m;
}
}
@Description("Test signal sending an object path")
diff --git a/org/freedesktop/dbus/test/test.java b/org/freedesktop/dbus/test/test.java
index 37b1ed5..f666d06 100644
--- a/org/freedesktop/dbus/test/test.java
+++ b/org/freedesktop/dbus/test/test.java
@@ -440,6 +440,14 @@ class arraysignalhandler implements DBusSigHandler<TestSignalInterface.TestArray
!"hey".equals(t.v.get(0).a.get(3)) ||
!"aloha".equals(t.v.get(0).a.get(4)))
test.fail("Incorrect TestArraySignal parameters");
+
+ if (t.m.keySet().size() != 2) test.fail("Incorrect TestArraySignal map size: should be 2, actually "+t.m.keySet().size());
+ if (!(t.m.get(new UInt32(1)).b.getValue() instanceof UInt64) ||
+ 678L != ((UInt64) t.m.get(new UInt32(1)).b.getValue()).longValue() ||
+ !(t.m.get(new UInt32(42)).b.getValue() instanceof UInt64) ||
+ 789L != ((UInt64) t.m.get(new UInt32(42)).b.getValue()).longValue())
+ test.fail("Incorrect TestArraySignal parameters");
+
} catch (Exception e) {
e.printStackTrace();
test.fail("SignalHandler 2 threw an exception: "+e);
@@ -816,7 +824,10 @@ public class test
/** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */
List<TestStruct2> tsl = new Vector<TestStruct2>();
tsl.add(new TestStruct2(l, new Variant<UInt64>(new UInt64(567))));
- serverconn.sendSignal(new TestSignalInterface.TestArraySignal("/Test", tsl));
+ Map<UInt32, TestStruct2> tsm = new HashMap<UInt32, TestStruct2>();
+ tsm.put(new UInt32(1), new TestStruct2(l, new Variant<UInt64>(new UInt64(678))));
+ tsm.put(new UInt32(42), new TestStruct2(l, new Variant<UInt64>(new UInt64(789))));
+ serverconn.sendSignal(new TestSignalInterface.TestArraySignal("/Test", tsl, tsm));
System.out.println("done");