"Fossies" - the Fresh Open Source Software Archive

Member "seafile-client-7.0.4/tests/test_server-info.cpp" (19 Nov 2019, 1763 Bytes) of package /linux/www/seafile-client-7.0.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #include "test_server-info.h"
    2 #include <QSet>
    3 #include <QtTest/QtTest>
    4 
    5 #include "../src/api/server-info.h"
    6 
    7 void ServerInfoTest::testFeature() {
    8     ServerInfo info1;
    9     QString feature1 = "file-search,office-preview,seafile-pro";
   10     info1.parseFeatureFromStrings(feature1.split(','));
   11     QVERIFY(info1.proEdition);
   12     QVERIFY(info1.fileSearch);
   13     QVERIFY(info1.officePreview);
   14     QSet<QString> info1_set = feature1.split(',').toSet();
   15     QSet<QString> info1b_set = info1.getFeatureStrings().toSet();
   16     QCOMPARE(info1_set, info1b_set);
   17 
   18     ServerInfo info2;
   19     QString feature2 = "file-search,seafile-pro";
   20     info2.parseFeatureFromStrings(feature2.split(','));
   21     QVERIFY(info2.proEdition);
   22     QVERIFY(info2.fileSearch);
   23     QVERIFY(!info2.officePreview);
   24     QSet<QString> info2_set = feature2.split(',').toSet();
   25     QSet<QString> info2b_set = info2.getFeatureStrings().toSet();
   26     QCOMPARE(info2_set, info2b_set);
   27 
   28     ServerInfo info3;
   29     QString feature3 = "file-search,office-preview,seafile-pro";
   30     info3.parseFeatureFromStrings(feature3.split(','));
   31     QVERIFY(info3.proEdition);
   32     QVERIFY(info3.fileSearch);
   33     QVERIFY(info3.officePreview);
   34     QSet<QString> info3_set = feature3.split(',').toSet();
   35     QSet<QString> info3b_set = info3.getFeatureStrings().toSet();
   36     QCOMPARE(info3_set, info3b_set);
   37 
   38     info3.parseFeatureFromString("office-preview", false);
   39     QVERIFY(!info3.officePreview);
   40 }
   41 
   42 void ServerInfoTest::testVersion() {
   43     ServerInfo info;
   44     QString version = "1.2.4";
   45     info.parseVersionFromString(version);
   46     QCOMPARE(info.majorVersion, 1u);
   47     QCOMPARE(info.minorVersion, 2u);
   48     QCOMPARE(info.patchVersion, 4u);
   49     QCOMPARE(info.getVersionString(), version);
   50 }
   51 
   52 QTEST_APPLESS_MAIN(ServerInfoTest)