summaryrefslogtreecommitdiffhomepage
path: root/tracker-test
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-test')
-rw-r--r--tracker-test/lang/de_DE.ts22
-rw-r--r--tracker-test/lang/nl_NL.ts7
-rw-r--r--tracker-test/lang/ru_RU.ts7
-rw-r--r--tracker-test/lang/stub.ts7
-rw-r--r--tracker-test/lang/zh_CN.ts9
-rw-r--r--tracker-test/test.cpp62
-rw-r--r--tracker-test/test.h11
7 files changed, 75 insertions, 50 deletions
diff --git a/tracker-test/lang/de_DE.ts b/tracker-test/lang/de_DE.ts
new file mode 100644
index 00000000..e11372b6
--- /dev/null
+++ b/tracker-test/lang/de_DE.ts
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="de_DE">
+<context>
+ <name>test_metadata</name>
+ <message>
+ <source>Test tracker</source>
+ <translation>Test-Tracker</translation>
+ </message>
+</context>
+<context>
+ <name>test_ui</name>
+ <message>
+ <source>Sine wave</source>
+ <translation>Sinus-Welle</translation>
+ </message>
+ <message>
+ <source>Pressing &quot;Abort&quot; will immediately crash the application.</source>
+ <translation>Beim Klick auf „Abbrechen“ wird die Anwendung sofort abstürzen.</translation>
+ </message>
+</context>
+</TS>
diff --git a/tracker-test/lang/nl_NL.ts b/tracker-test/lang/nl_NL.ts
index 2917d26b..b4150273 100644
--- a/tracker-test/lang/nl_NL.ts
+++ b/tracker-test/lang/nl_NL.ts
@@ -2,6 +2,13 @@
<!DOCTYPE TS>
<TS version="2.1" language="nl_NL">
<context>
+ <name>test_metadata</name>
+ <message>
+ <source>Test tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>test_ui</name>
<message>
<source>Sine wave</source>
diff --git a/tracker-test/lang/ru_RU.ts b/tracker-test/lang/ru_RU.ts
index ca7d0ce3..c69b3728 100644
--- a/tracker-test/lang/ru_RU.ts
+++ b/tracker-test/lang/ru_RU.ts
@@ -2,6 +2,13 @@
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
+ <name>test_metadata</name>
+ <message>
+ <source>Test tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>test_ui</name>
<message>
<source>Sine wave</source>
diff --git a/tracker-test/lang/stub.ts b/tracker-test/lang/stub.ts
index ddba8441..78f647f5 100644
--- a/tracker-test/lang/stub.ts
+++ b/tracker-test/lang/stub.ts
@@ -2,6 +2,13 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
+ <name>test_metadata</name>
+ <message>
+ <source>Test tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>test_ui</name>
<message>
<source>Sine wave</source>
diff --git a/tracker-test/lang/zh_CN.ts b/tracker-test/lang/zh_CN.ts
index ddba8441..5df28f2f 100644
--- a/tracker-test/lang/zh_CN.ts
+++ b/tracker-test/lang/zh_CN.ts
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="zh_CN">
+<context>
+ <name>test_metadata</name>
+ <message>
+ <source>Test tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
<context>
<name>test_ui</name>
<message>
diff --git a/tracker-test/test.cpp b/tracker-test/test.cpp
index d37d7373..3ca47ae1 100644
--- a/tracker-test/test.cpp
+++ b/tracker-test/test.cpp
@@ -15,73 +15,49 @@
#include <cmath>
#include <QDebug>
-const double test_tracker::incr[6] =
+static const double incr[3] =
{
- 50, 40, 80,
- 70, 5, 3
+ 10, 5, 3
};
-test_tracker::test_tracker() :
- last_x { 0, 0, 0, 0, 0, 0 }
-{
-}
+static const double max_values[3] = {
+ 180, 2, 3,
+};
-test_tracker::~test_tracker()
-{
-}
+test_tracker::test_tracker() = default;
+test_tracker::~test_tracker() = default;
module_status test_tracker::start_tracker(QFrame*)
{
t.start();
-
- return status_ok();
+ return {};
}
-#ifdef EMIT_NAN
-# include <cstdlib>
-#endif
-
void test_tracker::data(double *data)
{
const double dt = t.elapsed_seconds();
t.start();
-#ifdef EMIT_NAN
- if ((rand()%4) == 0)
+ for (int i = 0; i < 3; i++)
{
- for (int i = 0; i < 6; i++)
- data[i] = 0./0.;
+ double last_ = last[i];
+ double max = max_values[i] * 2;
+ double incr_ = incr[i];
+ double x = fmod(last_ + incr_ * dt, max);
+ last[i] = x;
+ if (x > max_values[i])
+ x = -max + x;
+ data[i+3] = x;
}
- else
-#endif
- for (int i = 0; i < 6; i++)
- {
- double x = last_x[i] + incr[i] * dt;
- if (x > 180)
- x = -360 + x;
- else if (x < -180)
- x = 360 + x;
- x = copysign(fmod(fabs(x), 360), x);
- last_x[i] = x;
-
- if (i >= 3)
- {
- data[i] = x;
- }
- else
- {
- data[i] = x * 100/180.;
- }
- }
}
-test_dialog::test_dialog()
+test_dialog::test_dialog() // NOLINT(cppcoreguidelines-pro-type-member-init)
{
ui.setupUi(this);
connect(ui.buttonBox, &QDialogButtonBox::clicked, [this](QAbstractButton* btn) {
if (btn == ui.buttonBox->button(QDialogButtonBox::Abort))
- *(volatile int*)0 = 0;
+ *(volatile int*)nullptr /*NOLINT*/ = 0;
});
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
diff --git a/tracker-test/test.h b/tracker-test/test.h
index c7f19698..320145ad 100644
--- a/tracker-test/test.h
+++ b/tracker-test/test.h
@@ -2,7 +2,6 @@
#include "ui_test.h"
#include "api/plugin-api.hpp"
#include "compat/timer.hpp"
-#include "compat/macros.hpp"
#include <cmath>
@@ -15,8 +14,7 @@ public:
void data(double *data) override;
private:
- static const double incr[6];
- double last_x[6];
+ double last[6] {};
Timer t;
};
@@ -36,8 +34,9 @@ private slots:
class test_metadata : public Metadata
{
-public:
- QString name() { return _("Testing - sine wave"); }
- QIcon icon() { return QIcon(":/images/opentrack.png"); }
+ Q_OBJECT
+
+ QString name() override { return tr("Test tracker"); }
+ QIcon icon() override { return QIcon(":/images/opentrack.png"); }
};