From d088259739cb5ab749c4aaa2cf85f17c45e897b9 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 2 Dec 2016 17:15:11 +0000 Subject: [PATCH] Add aliased listener test, disabled for now. --- simgear/props/props_test.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/simgear/props/props_test.cxx b/simgear/props/props_test.cxx index a2b4e9e9..7e3c8721 100644 --- a/simgear/props/props_test.cxx +++ b/simgear/props/props_test.cxx @@ -672,6 +672,27 @@ void testListener() } +void testAliasedListeners() +{ + SGPropertyNode_ptr tree(new SGPropertyNode); + defineSamplePropertyTree(tree); + TestListener l(tree.get()); + + tree->getNode("position/world/x", true)->alias(tree->getNode("position/body/a")); + tree->getNode("position/earth", true)->alias(tree->getNode("position/body")); + + tree->getNode("position/world/x")->addChangeListener(&l); + tree->getNode("position/earth")->addChangeListener(&l); + + tree->setIntValue("position/body/a", 99); + COMPARE(tree->getIntValue("position/world/x"), 99); + COMPARE(l.checkValueChangeCount("position/world/x"), 1); + + tree->setIntValue("position/world/x", 101); + COMPARE(tree->getIntValue("position/body/a"), 101); + COMPARE(l.checkValueChangeCount("position/world/x"), 2); +} + class TiedPropertyDonor { @@ -841,6 +862,8 @@ int main (int ac, char ** av) testListener(); tiedPropertiesTest(); tiedPropertiesListeners(); + // disable test for the moment + // testAliasedListeners(); return 0; }