[Kst] branches/work/kst/portto4/kst/tests
Barth Netterfield
netterfield at astro.utoronto.ca
Fri May 23 16:03:51 CEST 2008
SVN commit 811608 by netterfield:
Add dirfile maker.
Some changes to tests related to new naming scheme.
A dirfile_maker (directory)
A dirfile_maker/dirfile_maker.c [License: UNKNOWN]
M +4 -4 testcsd.cpp
M +15 -11 testpsd.cpp
M +36 -34 testscalar.cpp
--- branches/work/kst/portto4/kst/tests/testcsd.cpp #811607:811608
@@ -114,6 +114,7 @@
Kst::VectorPtr vp = Kst::kst_cast<Kst::Vector>(_store.createObject<Kst::Vector>(Kst::ObjectTag::fromString("tempVector")));
Q_ASSERT(vp);
vp->resize(10);
+ vp->setDescriptiveName("tempVector");
for (int i = 0; i < 10; i++){
vp->value()[i] = i;
}
@@ -121,7 +122,7 @@
Kst::CSDPtr csd = new Kst::CSD(&_store, Kst::ObjectTag::fromString("csdTest"), vp, 0.0, false, false, false, WindowUndefined, 0, 0, 0.0, PSDUndefined, QString::null, QString::null);
QCOMPARE(csd->tag().tagString(), QLatin1String("csdTest"));
- QCOMPARE(csd->vector()->tag().tagString(), QLatin1String("tempVector"));
+ QCOMPARE(csd->vector()->descriptiveName(), QLatin1String("tempVector"));
QCOMPARE(csd->output(), PSDUndefined);
QVERIFY(!csd->apodize());
QVERIFY(!csd->removeMean());
@@ -145,7 +146,7 @@
csd->setGaussianSigma(0.2);
QCOMPARE(csd->tag().tagString(), QLatin1String("csdTest"));
- QCOMPARE(csd->vector()->tag().tagString(), QLatin1String("tempVector"));
+ QCOMPARE(csd->vector()->descriptiveName(), QLatin1String("tempVector"));
QCOMPARE(csd->output(), PSDAmplitudeSpectralDensity);
QVERIFY(csd->apodize());
QVERIFY(csd->removeMean());
@@ -181,8 +182,7 @@
vp2->value()[i] = i;
}
csdDOM->setVector(vp2);
-
- QCOMPARE(csdDOM->vector()->tag().tagString(), QLatin1String("tempVector2"));
+ QCOMPARE(csdDOM->vector()->descriptiveName(), QLatin1String("tempVector2"));
csdDOM->setWindowSize(9);
Kst::MatrixPtr outMatrix = csdDOM->outputMatrix();
--- branches/work/kst/portto4/kst/tests/testpsd.cpp #811607:811608
@@ -116,13 +116,14 @@
Kst::VectorPtr vp = Kst::kst_cast<Kst::Vector>(_store.createObject<Kst::Vector>(Kst::ObjectTag::fromString("tempVector")));
Q_ASSERT(vp);
vp->resize(10);
+ vp->setDescriptiveName("tempVector");
for (int i = 0; i < 10; i++){
vp->value()[i] = i;
}
Kst::PSDPtr psd = new Kst::PSD(&_store, Kst::ObjectTag::fromString("psdTest"), vp, 0.0, false, 10, false, false, QString("vUnits"), QString("rUnits"), WindowUndefined, 0.0, PSDUndefined);
QCOMPARE(psd->tag().tagString(), QLatin1String("psdTest"));
- QCOMPARE(psd->vector()->tag().tagString(), QLatin1String("tempVector"));
+ QCOMPARE(psd->vector()->descriptiveName(), QLatin1String("tempVector"));
QCOMPARE(psd->output(), PSDUndefined);
QVERIFY(!psd->apodize());
QVERIFY(!psd->removeMean());
@@ -155,7 +156,7 @@
psd->setGaussianSigma(0.2);
QCOMPARE(psd->tag().tagString(), QLatin1String("psdTest"));
- QCOMPARE(psd->vector()->tag().tagString(), QLatin1String("tempVector"));
+ QCOMPARE(psd->vector()->descriptiveName(), QLatin1String("tempVector"));
QCOMPARE(psd->output(), PSDAmplitudeSpectralDensity);
QVERIFY(psd->apodize());
QVERIFY(psd->removeMean());
@@ -182,17 +183,20 @@
QDomNode n = makeDOMElement("psdDOMPsd", "psdDOMVector").firstChild();
QDomElement e = n.toElement();
- Kst::PSDPtr psdDOM = new Kst::PSD(&_store, e);
- QCOMPARE(psdDOM->tag().tagString(), QLatin1String("psdDOMPsd"));
- QCOMPARE(psdDOM->output(), PSDAmplitudeSpectralDensity);
- QVERIFY(psdDOM->apodize());
- QVERIFY(psdDOM->removeMean());
- QVERIFY(psdDOM->average());
- QCOMPARE(psdDOM->frequency(), 128.0);
- QCOMPARE(psdDOM->apodizeFxn(), WindowOriginal);
- QCOMPARE(psdDOM->gaussianSigma(), 0.01);
+ //FIXME: should use factory, not this constructor. This constructor is no longer
+ // used anywhere in kst.
+// Kst::PSDPtr psdDOM = new Kst::PSD(&_store, e);
+// QCOMPARE(psdDOM->tag().tagString(), QLatin1String("psdDOMPsd"));
+// QCOMPARE(psdDOM->output(), PSDAmplitudeSpectralDensity);
+// QVERIFY(psdDOM->apodize());
+// QVERIFY(psdDOM->removeMean());
+// QVERIFY(psdDOM->average());
+// QCOMPARE(psdDOM->frequency(), 128.0);
+// QCOMPARE(psdDOM->apodizeFxn(), WindowOriginal);
+// QCOMPARE(psdDOM->gaussianSigma(), 0.01);
+
// Kst::VectorPtr vpVX = psdDOM->vX();
// for(int j = 0; j < vpVX->length(); j++){
// printf("[%d][%lf]", j, vpVX->value()[j]);
--- branches/work/kst/portto4/kst/tests/testscalar.cpp #811607:811608
@@ -96,41 +96,43 @@
QVERIFY(sp->displayable());
QVERIFY(sp2->displayable());
- QDomNode n;
- QDomElement e;
- n = makeDOMDocument("load1", "2.14159265").firstChild();
- e = n.toElement();
- Kst::ScalarPtr sp3 = new Kst::Scalar(&_store, e);
- QCOMPARE(sp3->orphan(), false);
- QCOMPARE(sp3->value(), 2.14159265);
- QCOMPARE(sp3->tag().tagString(), QLatin1String("load1"));
- QVERIFY(sp3->displayable());
+ // FIXME: This constructor is no longer used - test using the factory
+// QDomNode n;
+// QDomElement e;
+// n = makeDOMDocument("load1", "2.14159265").firstChild();
+// e = n.toElement();
+//
+// Kst::ScalarPtr sp3 = new Kst::Scalar(&_store, e);
+// QCOMPARE(sp3->orphan(), false);
+// QCOMPARE(sp3->value(), 2.14159265);
+// QCOMPARE(sp3->tag().tagString(), QLatin1String("load1"));
+// QVERIFY(sp3->displayable());
+//
+// n = makeDOMDocument("55.4232", "55.4232", true).firstChild();
+// e = n.toElement();
+// Kst::ScalarPtr sp4 = new Kst::Scalar(&_store, e);
+// QVERIFY(sp4->orphan());
+// QCOMPARE(sp4->value(), 55.4232);
+// QCOMPARE(sp4->tag().tagString(), QLatin1String("55.4232"));
+// QVERIFY(!sp4->displayable());
+//
+// n = makeDOMDocument("load2", "NAN").firstChild();
+// e = n.toElement();
+// sp4 = new Kst::Scalar(&_store, e);
+// QVERIFY(sp4->value() != sp4->value());
+//
+// n = makeDOMDocument("load3", "INF").firstChild();
+// e = n.toElement();
+// sp4 = new Kst::Scalar(&_store, e);
+//
+// QVERIFY(sp4->value() == INF);
+//
+// n = makeDOMDocument("load4", "-INF").firstChild();
+// e = n.toElement();
+// sp4 = new Kst::Scalar(&_store, e);
+//
+// QVERIFY(sp4->value() == -INF);
- n = makeDOMDocument("55.4232", "55.4232", true).firstChild();
- e = n.toElement();
- Kst::ScalarPtr sp4 = new Kst::Scalar(&_store, e);
- QVERIFY(sp4->orphan());
- QCOMPARE(sp4->value(), 55.4232);
- QCOMPARE(sp4->tag().tagString(), QLatin1String("55.4232"));
- QVERIFY(!sp4->displayable());
-
- n = makeDOMDocument("load2", "NAN").firstChild();
- e = n.toElement();
- sp4 = new Kst::Scalar(&_store, e);
- QVERIFY(sp4->value() != sp4->value());
-
- n = makeDOMDocument("load3", "INF").firstChild();
- e = n.toElement();
- sp4 = new Kst::Scalar(&_store, e);
-
- QVERIFY(sp4->value() == INF);
-
- n = makeDOMDocument("load4", "-INF").firstChild();
- e = n.toElement();
- sp4 = new Kst::Scalar(&_store, e);
-
- QVERIFY(sp4->value() == -INF);
-
delete listener;
}
More information about the Kst
mailing list