File: generalform_test.cpp

package info (click to toggle)
qtox 1.18.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 28,996 kB
  • sloc: cpp: 48,067; xml: 8,560; python: 704; sh: 232; makefile: 14
file content (43 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* SPDX-License-Identifier: GPL-3.0-or-later
 * Copyright © 2024-2025 The TokTok team.
 */

#include "src/widget/form/settings/generalform.h"

#include <QDirIterator>
#include <QTest>

class TestGeneralForm : public QObject
{
    Q_OBJECT
private slots:
    void testLocales();
};

void TestGeneralForm::testLocales()
{
    QDirIterator it(":/translations", QDirIterator::Subdirectories);
    QStringList translations;
    while (it.hasNext()) {
        it.next();
        translations << it.fileName();
    }
    QVERIFY(!translations.isEmpty());

    const QStringList locales = GeneralForm::getLocales();
    QVERIFY(!locales.isEmpty());

    // check if all locales are present in the translations
    for (const QString& locale : locales) {
        QVERIFY2(translations.contains(locale + ".qm"), qPrintable(locale + ".qm not found"));
    }

    // check if all translations are present in the locales
    for (const QString& translation : translations) {
        QVERIFY2(locales.contains(translation.left(translation.size() - 3)),
                 qPrintable(translation.left(translation.size() - 3) + " not found"));
    }
}

QTEST_GUILESS_MAIN(TestGeneralForm)
#include "generalform_test.moc"