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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
/* * This file is part of Maliit framework *
*
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* and appearing in the file LICENSE.LGPL included in the packaging
* of this file.
*/
#include "ft_exampleplugin.h"
#include "core-utils.h"
#include "gui-utils.h"
#include <minputmethodhost.h>
#include <maliit/plugins/inputmethodplugin.h>
#include <minputcontextconnection.h>
#include <QtCore>
#include <QtGui>
class MIndicatorServiceClient
{};
void Ft_ExamplePlugin::initTestCase()
{
}
void Ft_ExamplePlugin::cleanupTestCase()
{
}
void Ft_ExamplePlugin::init()
{}
void Ft_ExamplePlugin::cleanup()
{}
void Ft_ExamplePlugin::testFunction_data()
{
QTest::addColumn<QString>("testPluginPath");
// QTest::newRow("Hello world")
// << "helloworld/libcxxhelloworldplugin.so";
// QTest::newRow("Override")
// << "override/libcxxoverrideplugin.so";
}
void Ft_ExamplePlugin::testFunction()
{
QSKIP("Currently there are no example plugins to test");
QFETCH(QString, testPluginPath);
const QDir pluginDir = MaliitTestUtils::isTestingInSandbox() ?
QDir(IN_TREE_TEST_PLUGIN_DIR"/cxx") : QDir(MALIIT_TEST_PLUGINS_DIR"/examples/cxx");
const QString pluginPath = pluginDir.absoluteFilePath(testPluginPath);
const QString pluginId = QFileInfo(testPluginPath).baseName();
QVERIFY(pluginDir.exists(pluginPath));
QPluginLoader loader(pluginPath);
QObject *pluginInstance = loader.instance();
QVERIFY(pluginInstance != 0);
Maliit::Plugins::InputMethodPlugin *plugin = qobject_cast<Maliit::Plugins::InputMethodPlugin *>(pluginInstance);
QVERIFY(plugin != 0);
MaliitTestUtils::TestInputMethodHost host(pluginId, plugin->name());
plugin->createInputMethod(&host);
QCOMPARE(host.lastCommit, QString("Maliit"));
QCOMPARE(host.sendCommitCount, 1);
QCOMPARE(host.lastPreedit, QString("Mali"));
QCOMPARE(host.sendPreeditCount, 1);
}
QTEST_MAIN(Ft_ExamplePlugin)
|