Skip to content

Commit 229c485

Browse files
committed
admt: Resolve tests
Signed-off-by: John Lloyd Juanillo <[email protected]>
1 parent 894d871 commit 229c485

File tree

4 files changed

+11
-29
lines changed

4 files changed

+11
-29
lines changed

plugins/admt/include/admt/admtcontroller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ public Q_SLOTS:
268268
void streamBufferedData(const QVector<double> &value);
269269

270270
private:
271+
QWidget *m_page;
271272
iio_context *m_iioCtx;
272273
iio_buffer *m_iioBuffer;
273274
Connection *m_conn;

plugins/admt/include/admt/admtplugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class SCOPY_ADMT_EXPORT ADMTPlugin : public QObject, public PluginBase
5252
void unload() override;
5353
void initMetadata() override;
5454
QString description() override;
55+
QString version() override;
5556

5657
public Q_SLOTS:
5758
bool onConnect() override;

plugins/admt/src/admtplugin.cpp

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,7 @@ bool ADMTPlugin::compatible(QString m_param, QString category)
5858

5959
bool ADMTPlugin::loadPage()
6060
{
61-
// Here you must write the code for the plugin info page
62-
// Below is an example for an iio device
63-
/*m_page = new QWidget();
64-
m_page->setLayout(new QVBoxLayout(m_page));
65-
m_page->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
66-
m_infoPage = new InfoPage(m_page);
67-
m_infoPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
68-
m_page->layout()->addWidget(m_infoPage);
69-
m_page->layout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Preferred,
70-
QSizePolicy::Expanding));
71-
72-
auto cp = ContextProvider::GetInstance();
73-
struct iio_context *context = cp->open(m_param);
74-
ssize_t attributeCount = iio_context_get_attrs_count(context);
75-
for(int i = 0; i < attributeCount; ++i) {
76-
const char *name;
77-
const char *value;
78-
int ret = iio_context_get_attr(context, i, &name, &value);
79-
if(ret < 0) {
80-
qWarning(CAT_ADMTPLUGIN) << "Could not read attribute with
81-
index:" << i; continue;
82-
}
83-
84-
m_infoPage->update(name, value);
85-
}
86-
cp->close(m_param);
87-
m_page->ensurePolished();*/
61+
m_page = new QWidget();
8862
return true;
8963
}
9064

@@ -101,7 +75,9 @@ void ADMTPlugin::loadToolList()
10175
}
10276

10377
void ADMTPlugin::unload()
104-
{ /*delete m_infoPage;*/
78+
{
79+
delete m_page;
80+
delete m_admtController;
10581
}
10682

10783
QString ADMTPlugin::description() { return "Plugin for ADMT Harmonic Calibration"; }
@@ -163,4 +139,6 @@ void ADMTPlugin::initMetadata()
163139
)plugin");
164140
}
165141

142+
QString ADMTPlugin::version() { return "0.1"; }
143+
166144
#include "moc_admtplugin.cpp"

plugins/admt/test/tst_pluginloader.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private Q_SLOTS:
4444
};
4545

4646
#define PLUGIN_LOCATION "../../plugins"
47-
#define FILENAME PLUGIN_LOCATION "/libscopy-admtplugin.so"
47+
#define FILENAME PLUGIN_LOCATION "/libscopy-admt.so"
4848

4949
void TST_ADMTPlugin::fileExists()
5050
{
@@ -67,7 +67,9 @@ void TST_ADMTPlugin::className()
6767
void TST_ADMTPlugin::loaded()
6868
{
6969
QPluginLoader qp(FILENAME, this);
70+
qDebug() << qp.errorString();
7071
qp.load();
72+
7173
QVERIFY(qp.isLoaded());
7274
}
7375

0 commit comments

Comments
 (0)