Add missing files for the last commit.

This commit is contained in:
Felix Geyer 2012-10-28 15:42:19 +01:00
parent 606dbc6eb4
commit 58b6fb36f8
2 changed files with 94 additions and 0 deletions

55
tests/TestAutoType.cpp Normal file
View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TestAutoType.h"
#include <QtCore/QPluginLoader>
#include <QtTest/QTest>
#include "tests.h"
#include "core/FilePath.h"
#include "crypto/Crypto.h"
#include "autotype/AutoType.h"
#include "autotype/AutoTypePlatformPlugin.h"
#include "autotype/test/AutoTypeTestInterface.h"
void TestAutoType::initTestCase()
{
Crypto::init();
AutoType::createTestInstance();
QPluginLoader loader(filePath()->pluginPath("keepassx-autotype-test"));
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
QVERIFY(loader.instance());
m_platform = qobject_cast<AutoTypePlatformInterface*>(loader.instance());
QVERIFY(m_platform);
m_test = qobject_cast<AutoTypeTestInterface*>(loader.instance());
QVERIFY(m_test);
}
void TestAutoType::testInternal()
{
QVERIFY(m_platform->activeWindowTitle().isEmpty());
m_test->setActiveWindowTitle("Test");
QCOMPARE(m_platform->activeWindowTitle(), QString("Test"));
}
QTEST_GUILESS_MAIN(TestAutoType)

39
tests/TestAutoType.h Normal file
View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEEPASSX_TESTAUTOTYPE_H
#define KEEPASSX_TESTAUTOTYPE_H
#include <QtCore/QObject>
class AutoTypePlatformInterface;
class AutoTypeTestInterface;
class TestAutoType : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void testInternal();
private:
AutoTypePlatformInterface* m_platform;
AutoTypeTestInterface* m_test;
};
#endif // KEEPASSX_TESTAUTOTYPE_H