File indexing completed on 2024-05-12 15:47:07

0001 #include "kwalletpath.h"
0002 
0003 #include <QTest>
0004 #include <QTextStream>
0005 
0006 #include <KAboutData>
0007 #include <QDBusConnection>
0008 #include <QDBusConnectionInterface>
0009 #include <kwallet.h>
0010 
0011 static QTextStream _out(stdout, QIODevice::WriteOnly);
0012 
0013 void KWalletPathTest::init()
0014 {
0015     if (!qEnvironmentVariableIsSet("DISPLAY")) {
0016         QSKIP("$DISPLAY is not set. These tests cannot be done without a graphical system.");
0017     }
0018 }
0019 
0020 void KWalletPathTest::openWallet()
0021 {
0022     _out << "About to ask for wallet /tmp/test.kwl sync\n";
0023 
0024     KWallet::Wallet *wallet = KWallet::Wallet::openWallet(QStringLiteral("/tmp/test.kwl"), 0, KWallet::Wallet::Path);
0025     QVERIFY(wallet != nullptr);
0026 
0027     _out << "Got path wallet: " << (wallet != nullptr) << '\n';
0028 
0029     if (wallet) {
0030         _out << "Closing wallet\n";
0031         delete wallet;
0032     }
0033     _out.flush();
0034 }
0035 
0036 QTEST_GUILESS_MAIN(KWalletPathTest)
0037 
0038 #include "moc_kwalletpath.cpp"