aboutsummaryrefslogtreecommitdiff
path: root/autotests
diff options
context:
space:
mode:
Diffstat (limited to 'autotests')
-rw-r--r--autotests/CMakeLists.txt1
-rw-r--r--autotests/testfilecrypto.cpp17
-rw-r--r--autotests/testfilecrypto.h12
3 files changed, 30 insertions, 0 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 671d6c08..c11901bf 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -18,4 +18,5 @@ if(${PROJECT_NAME}_ENABLE_E2EE)
quotient_add_test(NAME testgroupsession)
quotient_add_test(NAME testolmsession)
quotient_add_test(NAME testolmutility)
+ quotient_add_test(NAME testfilecrypto)
endif()
diff --git a/autotests/testfilecrypto.cpp b/autotests/testfilecrypto.cpp
new file mode 100644
index 00000000..e6bec1fe
--- /dev/null
+++ b/autotests/testfilecrypto.cpp
@@ -0,0 +1,17 @@
+// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#include "testfilecrypto.h"
+#include "events/encryptedfile.h"
+#include <qtest.h>
+
+using namespace Quotient;
+void TestFileCrypto::encryptDecryptData()
+{
+ QByteArray data = "ABCDEF";
+ auto [file, cipherText] = EncryptedFile::encryptFile(data);
+ auto decrypted = file.decryptFile(cipherText);
+ QCOMPARE(data, decrypted);
+}
+QTEST_APPLESS_MAIN(TestFileCrypto)
diff --git a/autotests/testfilecrypto.h b/autotests/testfilecrypto.h
new file mode 100644
index 00000000..9096a8c7
--- /dev/null
+++ b/autotests/testfilecrypto.h
@@ -0,0 +1,12 @@
+// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#include <QtTest/QtTest>
+
+class TestFileCrypto : public QObject
+{
+ Q_OBJECT
+private Q_SLOTS:
+ void encryptDecryptData();
+};