diff options
author | flow <thiagodonato300@gmail.com> | 2022-04-07 19:03:29 -0300 |
---|---|---|
committer | flow <thiagodonato300@gmail.com> | 2022-04-07 19:08:01 -0300 |
commit | d0cda6d6051a09826820da3cd96fe5dc36b274f0 (patch) | |
tree | 230095a6e29e6ad781a44204938f879450d718f9 /launcher/tasks/Task_test.cpp | |
parent | 167e32a69fc0b4224d10e7a3c7ce13e4cb4334c7 (diff) | |
download | PrismLauncher-d0cda6d6051a09826820da3cd96fe5dc36b274f0.tar.gz PrismLauncher-d0cda6d6051a09826820da3cd96fe5dc36b274f0.tar.bz2 PrismLauncher-d0cda6d6051a09826820da3cd96fe5dc36b274f0.zip |
test: add basic Task unit test
Only only two tests for now. We can iterate on this later :^)
This is to try to avoid breaking things again!
Diffstat (limited to 'launcher/tasks/Task_test.cpp')
-rw-r--r-- | launcher/tasks/Task_test.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/launcher/tasks/Task_test.cpp b/launcher/tasks/Task_test.cpp new file mode 100644 index 00000000..a9a28bd0 --- /dev/null +++ b/launcher/tasks/Task_test.cpp @@ -0,0 +1,42 @@ +#include <QTest> +#include "TestUtil.h" + +#include "Task.h" + +/* Does nothing. Only used for testing. */ +class BasicTask : public Task { + Q_OBJECT + public: + explicit BasicTask() : Task() {}; + private: + void executeTask() override {}; +}; + +class TaskTest : public QObject { + Q_OBJECT + + private slots: + void test_SetStatus(){ + BasicTask t; + QString status {"test status"}; + + t.setStatus(status); + + QCOMPARE(t.getStatus(), status); + } + + void test_SetProgress(){ + BasicTask t; + int current = 42; + int total = 207; + + t.setProgress(current, total); + + QCOMPARE(t.getProgress(), current); + QCOMPARE(t.getTotalProgress(), total); + } +}; + +QTEST_GUILESS_MAIN(TaskTest) + +#include "Task_test.moc" |