81TEST_CASE(
"Changing target and catObj name",
"[observerCtrl]" )
84 SECTION(
"Catalog updates, no object in INDI prop" )
86 pcf::IndiProperty ip( pcf::IndiProperty::Text );
88 ip.setDevice(
"tcsi" );
89 ip.setName(
"catalog" );
90 ip.add( pcf::IndiElement(
"noobject" ) );
92 ip[
"noobject"] =
"target0";
96 int rv = obs.setCallBack_m_indiP_catalog(ip);
102 SECTION(
"setting target, no current or target" )
104 pcf::IndiProperty ip( pcf::IndiProperty::Text );
106 ip.setDevice(
"observers" );
107 ip.setName(
"target" );
108 ip.add( pcf::IndiElement(
"novalid" ) );
110 ip[
"novalid"] =
"target1";
114 int rv = obs.newCallBack_m_indiP_target(ip);
120 SECTION(
"setting tcsTarget, no request" )
122 pcf::IndiProperty ip( pcf::IndiProperty::Switch );
124 ip.setDevice(
"observers" );
125 ip.setName(
"tcsTarget" );
126 ip.add( pcf::IndiElement(
"norequest" ) );
128 ip[
"norequest"].setSwitchState(pcf::IndiElement::On);
132 int rv = obs.newCallBack_m_indiP_tcsTarget(ip);
138 SECTION(
"Catalog and target, while not observing" )
141 obs.observing() =
false;
142 obs.newTargetBlock() =
false;
144 pcf::IndiProperty ip( pcf::IndiProperty::Text );
146 ip.setDevice(
"tcsi" );
147 ip.setName(
"catalog" );
148 ip.add( pcf::IndiElement(
"object" ) );
150 ip[
"object"] =
"target0";
152 int rv = obs.setCallBack_m_indiP_catalog(ip);
155 REQUIRE( obs.catObj() ==
"target0");
156 REQUIRE( obs.newTargetBlock() ==
false);
157 REQUIRE( obs.newPointing() ==
true );
159 pcf::IndiProperty ip2( pcf::IndiProperty::Text );
161 ip2.setDevice(
"observers" );
162 ip2.setName(
"target" );
163 ip2.add( pcf::IndiElement(
"target" ) );
165 ip2[
"target"] =
"target1";
167 rv = obs.newCallBack_m_indiP_target(ip2);
170 REQUIRE( obs.target() ==
"target1");
171 REQUIRE( obs.newTargetBlock() ==
true);
172 REQUIRE( obs.newPointing() ==
false );
174 pcf::IndiProperty ip3( pcf::IndiProperty::Switch );
176 ip3.setDevice(
"observers" );
177 ip3.setName(
"tcsTarget" );
178 ip3.add( pcf::IndiElement(
"request" ) );
180 obs.newTargetBlock() =
false;
181 obs.newPointing() =
true;
182 ip3[
"request"].setSwitchState(pcf::IndiElement::Off);
185 rv = obs.newCallBack_m_indiP_tcsTarget(ip3);
188 REQUIRE( obs.catObj() ==
"target0");
189 REQUIRE( obs.target() ==
"target1");
190 REQUIRE( obs.newTargetBlock() ==
false);
191 REQUIRE( obs.newPointing() ==
true );
194 ip3[
"request"].setSwitchState(pcf::IndiElement::On);
196 rv = obs.newCallBack_m_indiP_tcsTarget(ip3);
199 REQUIRE( obs.catObj() ==
"target0");
200 REQUIRE( obs.target() ==
"target0");
201 REQUIRE( obs.newTargetBlock() ==
true);
202 REQUIRE( obs.newPointing() ==
false );
207 SECTION(
"Catalog and target, while observing" )
210 obs.observing() =
true;
211 obs.newTargetBlock() =
false;
213 pcf::IndiProperty ip( pcf::IndiProperty::Text );
215 ip.setDevice(
"tcsi" );
216 ip.setName(
"catalog" );
217 ip.add( pcf::IndiElement(
"object" ) );
219 ip[
"object"] =
"target0";
221 int rv = obs.setCallBack_m_indiP_catalog(ip);
224 REQUIRE( obs.catObj() ==
"target0");
225 REQUIRE( obs.newTargetBlock() ==
false);
226 REQUIRE( obs.newPointing() ==
true );
228 pcf::IndiProperty ip2( pcf::IndiProperty::Text );
230 ip2.setDevice(
"observers" );
231 ip2.setName(
"target" );
232 ip2.add( pcf::IndiElement(
"target" ) );
234 ip2[
"target"] =
"target1";
236 rv = obs.newCallBack_m_indiP_target(ip2);
239 REQUIRE( obs.catObj() ==
"target0");
240 REQUIRE( obs.target() ==
"");
241 REQUIRE( obs.newTargetBlock() ==
false);
242 REQUIRE( obs.newPointing() ==
true );
244 pcf::IndiProperty ip3( pcf::IndiProperty::Switch );
246 ip3.setDevice(
"observers" );
247 ip3.setName(
"tcsTarget" );
248 ip3.add( pcf::IndiElement(
"request" ) );
251 ip3[
"request"].setSwitchState(pcf::IndiElement::Off);
253 rv = obs.newCallBack_m_indiP_tcsTarget(ip3);
256 REQUIRE( obs.catObj() ==
"target0");
257 REQUIRE( obs.target() ==
"");
260 ip3[
"request"].setSwitchState(pcf::IndiElement::On);
262 rv = obs.newCallBack_m_indiP_tcsTarget(ip3);
265 REQUIRE( obs.catObj() ==
"target0");
266 REQUIRE( obs.target() ==
"");