Source
69
69
csys.spectralCoordinate().restFrequency(), "Hz"
70
70
);
71
71
Vector<Stokes::StokesTypes> stokes(0);
72
72
try {
73
73
AnnAnnulus annulus(
74
74
centerx, centery, inner, outer, dirTypeString,
75
75
csys, shape, beginFreq, endFreq, freqRefFrameString,
76
76
dopplerString, restfreq, stokes, false
77
77
);
78
78
thrown = false;
79
-
} catch (AipsError x) {
79
+
} catch (const AipsError& x) {
80
80
log << LogIO::NORMAL
81
81
<< "Exception thrown as expected: " << x.getMesg()
82
82
<< LogIO::POST;
83
83
}
84
84
AlwaysAssert(thrown, AipsError);
85
85
}
86
86
{
87
87
log << LogIO::NORMAL
88
88
<< "Test that bad quantity for world direction coordinate throws exception"
89
89
<< LogIO::POST;
107
107
csys.spectralCoordinate().restFrequency(), "Hz"
108
108
);
109
109
Vector<Stokes::StokesTypes> stokes(0);
110
110
try {
111
111
AnnAnnulus annulus(
112
112
centerx, centery, inner, outer, dirTypeString,
113
113
csys, shape, beginFreq, endFreq, freqRefFrameString,
114
114
dopplerString, restfreq, stokes, false
115
115
);
116
116
thrown = false;
117
-
} catch (AipsError x) {
117
+
} catch (const AipsError& x) {
118
118
log << LogIO::NORMAL
119
119
<< "Exception thrown as expected: " << x.getMesg()
120
120
<< LogIO::POST;
121
121
}
122
122
AlwaysAssert(thrown, AipsError);
123
123
}
124
124
{
125
125
log << LogIO::NORMAL
126
126
<< "Test that inner radius larger than outer radius throws exception"
127
127
<< LogIO::POST;
145
145
csys.spectralCoordinate().restFrequency(), "Hz"
146
146
);
147
147
Vector<Stokes::StokesTypes> stokes(0);
148
148
try {
149
149
AnnAnnulus annulus(
150
150
centerx, centery, inner, outer, dirTypeString,
151
151
csys, shape, beginFreq, endFreq, freqRefFrameString,
152
152
dopplerString, restfreq, stokes, false
153
153
);
154
154
thrown = false;
155
-
} catch (AipsError x) {
155
+
} catch (const AipsError& x) {
156
156
log << LogIO::NORMAL
157
157
<< "Exception thrown as expected: " << x.getMesg()
158
158
<< LogIO::POST;
159
159
}
160
160
AlwaysAssert(thrown, AipsError);
161
161
}
162
162
{
163
163
log << LogIO::NORMAL
164
164
<< "Test that shape and coordinate system mismatch throws exception"
165
165
<< LogIO::POST;
183
183
csys.spectralCoordinate().restFrequency(), "Hz"
184
184
);
185
185
Vector<Stokes::StokesTypes> stokes(0);
186
186
try {
187
187
AnnAnnulus annulus(
188
188
centerx, centery, inner, outer, dirTypeString,
189
189
csys, IPosition(3, 40, 40, 2), beginFreq, endFreq, freqRefFrameString,
190
190
dopplerString, restfreq, stokes, false
191
191
);
192
192
thrown = false;
193
-
}
194
-
catch (AipsError x) {
193
+
} catch (const AipsError& x) {
195
194
log << LogIO::NORMAL
196
195
<< "Exception thrown as expected: " << x.getMesg()
197
196
<< LogIO::POST;
198
197
}
199
198
AlwaysAssert(thrown, AipsError);
200
199
}
201
200
202
201
{
203
202
log << LogIO::NORMAL << "Test region outside image throws exception"
204
203
<< LogIO::POST;
207
206
Quantity centery(400, "pix");
208
207
Quantity inner(30, "arcsec");
209
208
Quantity outer(40, "arcsec");
210
209
Vector<Stokes::StokesTypes> stokes(0);
211
210
try {
212
211
AnnAnnulus ann(
213
212
centerx, centery, inner, outer,
214
213
csys, shape, stokes
215
214
);
216
215
thrown = false;
217
-
} catch (ToLCRegionConversionError x) {
216
+
} catch (const ToLCRegionConversionError& x) {
218
217
log << LogIO::NORMAL
219
218
<< "Exception thrown as expected: " << x.getMesg()
220
219
<< LogIO::POST;
221
220
}
222
221
AlwaysAssert(thrown, AipsError);
223
222
}
224
223
{
225
224
log << LogIO::NORMAL << "Test region outside image not required"
226
225
<< LogIO::POST;
227
226
Bool thrown = true;
230
229
Quantity inner(30, "arcsec");
231
230
Quantity outer(40, "arcsec");
232
231
Vector<Stokes::StokesTypes> stokes(0);
233
232
Bool requireRegion(false);
234
233
try {
235
234
AnnAnnulus ann(
236
235
centerx, centery, inner, outer,
237
236
csys, shape, stokes, requireRegion
238
237
);
239
238
thrown = false;
240
-
} catch (ToLCRegionConversionError x) {
239
+
} catch (const ToLCRegionConversionError& x) {
241
240
log << LogIO::NORMAL
242
241
<< "Unexpected exception thrown: " << x.getMesg()
243
242
<< LogIO::POST;
244
243
}
245
244
AlwaysAssert(!thrown, AipsError);
246
245
}
247
246
248
247
{
249
248
log << LogIO::NORMAL << "Test precision"
250
249
<< LogIO::POST;
710
709
centerx, centery, inner, outer, dirTypeString,
711
710
csys, shape, beginFreq, endFreq, freqRefFrameString,
712
711
dopplerString, restfreq, stokes, false
713
712
);
714
713
{
715
714
// we don't support this color name
716
715
Bool thrown = false;
717
716
try {
718
717
annulus.setColor("purple");
719
718
AlwaysAssert(false, AipsError);
720
-
}
721
-
catch (AipsError x) {
719
+
} catch (const AipsError& x) {
722
720
log << LogIO::NORMAL << "Exception caught as expected: "
723
721
<< x.getMesg() << LogIO::POST;
724
722
thrown = true;
725
723
}
726
724
AlwaysAssert(thrown, AipsError);
727
725
}
728
726
{
729
727
// bad hex spec
730
728
Bool thrown = false;
731
729
try {
732
730
annulus.setColor("GG0022");
733
731
AlwaysAssert(false, AipsError);
734
-
}
735
-
catch (AipsError x) {
732
+
} catch (const AipsError& x) {
736
733
log << LogIO::NORMAL << "Exception caught as expected: "
737
734
<< x.getMesg() << LogIO::POST;
738
735
thrown = true;
739
736
}
740
737
AlwaysAssert(thrown, AipsError);
741
738
}
742
739
annulus.setColor("FF0000");
743
740
AlwaysAssert(annulus.getColorString() == "red", AipsError);
744
741
cout << "ann 1st color " << annulus << endl;
745
742
annulus.setColor("Ff15De");
759
756
annulus.setLabelColor("yellow");
760
757
cout << annulus << endl;
761
758
annulus.setLabel("");
762
759
cout << annulus << endl;
763
760
//int font_style = annulus.getFontStyle();
764
761
annulus.setFontStyle(AnnotationBase::ITALIC_BOLD);
765
762
ostringstream oss;
766
763
annulus.print(oss);
767
764
cout << oss.str() << endl;
768
765
}
769
-
}
770
-
catch (AipsError x) {
766
+
} catch (const AipsError& x) {
771
767
cerr << "Caught exception: " << x.getMesg() << endl;
772
768
return 1;
773
769
}
774
770
775
771
cout << "OK" << endl;
776
772
return 0;
777
773
}