File indexing completed on 2024-06-23 03:58:16
0001 #include <stdio.h> 0002 #include <stdlib.h> 0003 0004 #include <QApplication> 0005 #include <QString> 0006 0007 #include "kwalletbackend.h" 0008 0009 int main(int argc, char **argv) 0010 { 0011 QApplication a(argc, argv); 0012 a.setApplicationName(QStringLiteral("backendtest")); 0013 0014 KWallet::Backend be(QStringLiteral("ktestwallet")); 0015 printf("KWalletBackend constructed\n"); 0016 0017 QByteArray apass("apassword", 9); 0018 QByteArray bpass("bpassword", 9); 0019 0020 printf("Passwords initialised.\n"); 0021 be.setPassword(apass); 0022 int rc = be.close(true); 0023 0024 printf("be.close(true) returned %d (should be -255)\n", rc); 0025 0026 rc = be.open(bpass); 0027 0028 printf("be.open(bpass) returned %d (should be 0 or 1)\n", rc); 0029 0030 rc = be.close(true); 0031 0032 printf("be.close(true) returned %d (should be 0)\n", rc); 0033 0034 rc = be.open(apass); 0035 0036 printf("be.open(apass) returned %d (should be negative)\n", rc); 0037 0038 rc = be.open(bpass); 0039 0040 printf("be.open(bpass) returned %d (should be 0)\n", rc); 0041 0042 return 0; 0043 }