aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Berres <armin.berres@basyskom.de>2010-07-20 16:34:04 +0200
committerSergiy Dubovik <sergiy.dubovik@nokia.com>2010-07-22 12:50:46 +0300
commitef132d1b9f00d1a1a37622bdbd61a88c50696ef0 (patch)
treeaeb4f0a5092c4ba371689649ff42938d846eda5d
parent5003bdb9c8a9f514e5693dcd6ad085d8839c2cd2 (diff)
Changes: revive themedaemon stress test
RevBy: TrustMe Details: The stress test did not work anymore. I updated the used themes and ported it to use MRemoteThemeDaemon instead of an own implementation. Not all problems are fixed yet, when multiple clients are running sometimes the themedaemon and the clients get slightly out of sync for a short timeframe.
-rw-r--r--mthemedaemon/test/client.cpp218
-rw-r--r--mthemedaemon/test/client.h23
-rw-r--r--mthemedaemon/test/clientmanager.cpp24
-rw-r--r--mthemedaemon/test/clientmanager.h6
-rw-r--r--mthemedaemon/test/main.cpp21
-rw-r--r--mthemedaemon/test/mthemedaemontest.pro11
-rw-r--r--mthemedaemon/test/stresstest.pro13
-rw-r--r--mthemedaemon/test/testdaemon/testdaemon.pro5
-rw-r--r--mthemedaemon/test/themes/base/index.theme8
-rw-r--r--mthemedaemon/test/themes/base/m/libduicore/style/libdui.css1
-rw-r--r--mthemedaemon/test/themes/base/meegotouch/libmeegotouchcore/style/dummy0
-rw-r--r--mthemedaemon/test/themes/devel/index.theme8
-rw-r--r--mthemedaemon/test/themes/devel/meegotouch/libmeegotouchcore/style/dummy0
-rw-r--r--mthemedaemon/test/themes/theme_one/index.theme8
-rw-r--r--mthemedaemon/test/themes/theme_one/m/constants.ini34
-rw-r--r--mthemedaemon/test/themes/theme_one/m/locale/fi/constants.ini34
-rw-r--r--src/corelib/theme/mremotethemedaemon.h3
17 files changed, 144 insertions, 273 deletions
diff --git a/mthemedaemon/test/client.cpp b/mthemedaemon/test/client.cpp
index a27e73e3..60982640 100644
--- a/mthemedaemon/test/client.cpp
+++ b/mthemedaemon/test/client.cpp
@@ -17,16 +17,23 @@
**
****************************************************************************/
+#include "client.h"
+#include "clientmanager.h"
+
+#include "mtheme.h"
+#include "mtheme_p.h"
+#include "mthemedaemon.h"
+#include "mthemedaemonprotocol.h"
+#include "imthemedaemon.h"
+#include "mremotethemedaemon.h"
+#include "mremotethemedaemon_p.h"
+#include "mgconfitem.h"
+
#include <stdlib.h>
#include <QTimer>
#include <QDebug>
#include <QPainter>
#include <QImage>
-#include <MGConfItem>
-#include "client.h"
-#include "clientmanager.h"
-#include "mthemedaemon.h"
-#include "mthemedaemonprotocol.h"
using namespace M::MThemeDaemonProtocol;
@@ -36,11 +43,11 @@ ClientThread::ClientThread(ClientManager* manager) : manager(manager)
void ClientThread::run()
{
- Client client(identifier);
- connect(&client,
- SIGNAL(pixmapReady(const QString&, Client*, quint32, const QString&, const QSize&)),
+ TestClient client(identifier);
+ connect(&client,
+ SIGNAL(pixmapReady(const QString&, TestClient*, quint32, const QString&, const QSize&)),
manager,
- SLOT(pixmapReady(const QString&, Client*, quint32, const QString&, const QSize&)));
+ SLOT(pixmapReady(const QString&, TestClient*, quint32, const QString&, const QSize&)));
exec();
}
@@ -55,7 +62,7 @@ const QString &ClientThread::getId() const
return identifier;
}
-Client::Client(const QString &identifier) : identifier(identifier), registered(false), packetsSent(0)
+TestClient::TestClient(const QString &identifier) : identifier(identifier)
{
operationCount = rand() % MAX_OPERATION_COUNT;
@@ -83,79 +90,59 @@ Client::Client(const QString &identifier) : identifier(identifier), registered(f
}
}
- stream.setDevice(&socket);
+ daemon = new MRemoteThemeDaemon(identifier, 0);
+ if (!daemon->connected()) {
+ qCritical("Could not connect to remote themedaemon");
+ return;
+ }
- connect(&socket, SIGNAL(connected()), SLOT(connected()));
- connect(&socket, SIGNAL(disconnected()), SLOT(disconnected()));
- connect(&socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ currentTheme = daemon->themeInheritanceChain().at(0);
- // connect to server
- socket.connectToServer(M::MThemeDaemonProtocol::ServerAddress);
+ connect(daemon, SIGNAL(pixmapChanged(QString, QSize, Qt::HANDLE)),
+ SLOT(pixmapChangedSlot(QString, QSize, Qt::HANDLE)));
+ connect(daemon, SIGNAL(themeChanged(QStringList, QStringList)),
+ SLOT(themeChangedSlot(QStringList, QStringList)));
- if (!socket.waitForConnected(10000)) {
- qDebug() << "ERROR:" << identifier << "- failed to connect server:" << socket.error();
- } else {
- // perform some task once we get into event loop
- QTimer::singleShot(0, this, SLOT(sendPacket()));
- }
+ connect(&daemon->d_ptr->socket, SIGNAL(connected()), SLOT(connected()));
+ connect(&daemon->d_ptr->socket, SIGNAL(disconnected()), SLOT(disconnected()));
+
+ QTimer::singleShot(0, this, SLOT(sendPacket()));
}
-Client::~Client()
+TestClient::~TestClient()
{
- if (socket.state() == QLocalSocket::ConnectedState) {
- socket.disconnectFromServer();
- }
+
}
-const QString &Client::getId() const
+const QString &TestClient::getId() const
{
return identifier;
}
-void Client::connected()
+void TestClient::connected()
{
// QLocalSocket* socket = qobject_cast<QLocalSocket*>(sender());
}
-void Client::disconnected()
+void TestClient::disconnected()
{
// QLocalSocket* socket = qobject_cast<QLocalSocket*>(sender());
}
-M::MThemeDaemonProtocol::Packet Client::processOnePacket()
+void TestClient::pixmapChangedSlot(const QString &imageId, const QSize &size, Qt::HANDLE pixmapHandle)
{
- Packet packet;
- stream >> packet;
-
- switch (packet.type()) {
- case Packet::PixmapUpdatedPacket: {
- const PixmapHandle *handle = static_cast<const PixmapHandle *>(packet.data());
-
- if(handle->pixmapHandle) {
- emit pixmapReady(currentTheme, this, handle->pixmapHandle, handle->identifier.imageId, handle->identifier.size);
- waitVerify.acquire();
- } else {
- qDebug() << "ERROR: daemon returned null handle for" << handle->identifier.imageId;
- }
- } break;
-
- case Packet::ThemeChangedPacket: {
- const M::MThemeDaemonProtocol::ThemeChangeInfo *data = static_cast<const M::MThemeDaemonProtocol::ThemeChangeInfo *>(packet.data());
- currentTheme = data->themeInheritance.at(0);
- }break;
-
- case Packet::ThemeDaemonStatusPacket:
- break;
-
- default:
- break;
- }
+ emit pixmapReady(currentTheme, this, pixmapHandle, imageId, size);
+ waitVerify.acquire();
+}
- return packet;
+void TestClient::themeChangedSlot(const QStringList &themeInheritance, const QStringList& libraryNames)
+{
+ currentTheme = themeInheritance.at(0);
}
-void Client::pixmapVerified(const QString& imageId, const QSize& size)
+void TestClient::pixmapVerified(const QString& imageId, const QSize& size)
{
+
PixmapIdentifier identifier(imageId, size);
if (requestedPixmaps.contains(identifier)) {
@@ -165,27 +152,18 @@ void Client::pixmapVerified(const QString& imageId, const QSize& size)
} else if(readyPixmaps.contains(identifier)) {
// this pixmap was already ready, so it is just updated (probably due to theme change)
} else {
- qDebug() << "ERROR:" << imageId << "- pixmap reply to unknown request";
+ qWarning() << "ERROR:" << imageId << "- pixmap reply to unknown request";
}
waitVerify.release();
}
-
-void Client::readyRead()
-{
- while (socket.bytesAvailable() > 0) {
- processOnePacket();
- }
-}
-
-void Client::sendPacket()
+void TestClient::sendPacket()
{
if (operationCount > 0) {
// randomize a task to us
Task task = (Task)(rand() % NumberOfTasks);
-
switch (task) {
case RegisterToServer:
registerToServer();
@@ -220,6 +198,8 @@ void Client::sendPacket()
// it was already requested, should we try to request some other pixmap instead?
// nah, go away and do something else next time..
}
+ } else {
+ qWarning() << "request empty";
}
} break;
@@ -261,109 +241,59 @@ void Client::sendPacket()
}
}
-void Client::registerToServer()
+void TestClient::registerToServer()
{
-#ifdef PRINT_INFO_MESSAGES
- qDebug() << "INFO:" << identifier << "- registering to server";
-#endif
- Packet registration(Packet::RequestRegistrationPacket, packetsSent++);
+ Packet registration(Packet::RequestRegistrationPacket, ++daemon->d_ptr->sequenceCounter);
registration.setData(new String(identifier));
- stream << registration;
-
- registered = true;
+ daemon->d_ptr->stream << registration;
}
-void Client::requestPixmap(M::MThemeDaemonProtocol::PixmapIdentifier &pixmapIdentifier)
+void TestClient::requestPixmap(M::MThemeDaemonProtocol::PixmapIdentifier &pixmapIdentifier)
{
#ifdef PRINT_INFO_MESSAGES
qDebug() << "INFO:" << identifier << "- requesting pixmap" << pixmapIdentifier.imageId << pixmapIdentifier.size;
#endif
- Packet packet(Packet::RequestPixmapPacket, packetsSent++);
- packet.setData(new PixmapIdentifier(pixmapIdentifier));
- stream << packet;
- if (registered) {
- requestedPixmaps.insert(pixmapIdentifier);
- }
+ daemon->pixmapHandle(pixmapIdentifier.imageId, pixmapIdentifier.size);
+ requestedPixmaps.insert(pixmapIdentifier);
}
-void Client::releasePixmap(M::MThemeDaemonProtocol::PixmapIdentifier &pixmapIdentifier)
+void TestClient::releasePixmap(M::MThemeDaemonProtocol::PixmapIdentifier &pixmapIdentifier)
{
#ifdef PRINT_INFO_MESSAGES
qDebug() << "INFO:" << identifier << "- releasing pixmap" << pixmapIdentifier.imageId << pixmapIdentifier.size;
#endif
- Packet packet(Packet::ReleasePixmapPacket, packetsSent++);
- packet.setData(new PixmapIdentifier(pixmapIdentifier));
- stream << packet;
+ daemon->releasePixmap(pixmapIdentifier.imageId, pixmapIdentifier.size);
readyPixmaps.remove(pixmapIdentifier);
requestedPixmaps.remove(pixmapIdentifier);
}
-void Client::checkConsistency()
+void TestClient::checkConsistency()
{
- if (!registered)
- return;
-
bool consistency = false;
- // disconnect signal
- disconnect(&socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
-
// send status query packet
- Packet packet(Packet::QueryThemeDaemonStatusPacket, packetsSent++);
- stream << packet;
- if (!socket.flush()) {
- qDebug() << "ERROR:" << identifier << "- failed to write to socket" << socket.error();
- }
-
- bool done = false;
- while (!done) {
- // wait for response
- if (socket.waitForReadyRead(10000)) {
- while (socket.bytesAvailable() > 0) {
- // handle packet that was received
- Packet packet = processOnePacket();
-
- // check whether it's correct type
- if (packet.type() == Packet::ThemeDaemonStatusPacket) {
-
- // extract reply and perform consistency check
- const ClientList *list = static_cast<const ClientList *>(packet.data());
- consistency = isDataConsistent(list);
- done = true;
- break;
- }
- }
- } else {
- // something bad happened, we did not get reply
- qDebug() << "ERROR:" << identifier << "- failed to receive data from socket" << socket.error();
- break;
- }
+ int sequenceNr = ++daemon->d_ptr->sequenceCounter;
+ Packet packet(Packet::QueryThemeDaemonStatusPacket, sequenceNr);
+ daemon->d_ptr->stream << packet;
+ if (!daemon->d_ptr->socket.flush()) {
+ qWarning() << "ERROR:" << identifier << "- failed to write to socket" << daemon->d_ptr->socket.error();
}
- // reconnect signal back
- connect(&socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
-
- // process rest of the packets
- readyRead();
+ Packet packet2 = daemon->d_ptr->waitForPacket(sequenceNr);
+ const ClientList *list = static_cast<const ClientList *>(packet2.data());
+ consistency = isDataConsistent(list);
if (!consistency) {
- qDebug() << "ERROR:" << identifier << "- Consistency check FAILED!";
+ qWarning() << "ERROR:" << identifier << "- Consistency check FAILED!";
}
}
-bool Client::isDataConsistent(const M::MThemeDaemonProtocol::ClientList *list)
+bool TestClient::isDataConsistent(const M::MThemeDaemonProtocol::ClientList *list)
{
foreach(ClientInfo info, list->clients) {
// find correct info
if (info.name == identifier) {
-
- // check that we're really registered
- if (!registered) {
- // we're not registered but our name is still in the client list
- return false;
- }
-
// theme change may cause pixmaps to move from loaded list to request list in daemon side,
// so we'll compare both lists as one
@@ -379,7 +309,7 @@ bool Client::isDataConsistent(const M::MThemeDaemonProtocol::ClientList *list)
// check that the daemon has correct amount of pixmaps in load queue
if (daemon.count() != client.count()) {
- qDebug() << "ERROR:" << identifier << "- incorrect pixmap count, Themedaemon says:" << daemon.count() << "and client says:" << client.count();
+ qWarning() << "ERROR:" << identifier << "- incorrect pixmap count, Themedaemon says:" << daemon.count() << "and client says:" << client.count();
break;
}
@@ -387,7 +317,7 @@ bool Client::isDataConsistent(const M::MThemeDaemonProtocol::ClientList *list)
foreach(const PixmapIdentifier & pixmapIdentifier, daemon) {
if (!client.contains(pixmapIdentifier)) {
// pixmap not found from client, but themedaemon reported it -> inconsistent state
- qDebug() << "ERROR:" << identifier << "- pixmap not found from client-side list:" << pixmapIdentifier.imageId << '(' << pixmapIdentifier.size << ')';
+ qWarning() << "ERROR:" << identifier << "- pixmap not found from client-side list:" << pixmapIdentifier.imageId << '(' << pixmapIdentifier.size << ')';
break;
} else {
// found, we can remove this one from client list
@@ -399,7 +329,7 @@ bool Client::isDataConsistent(const M::MThemeDaemonProtocol::ClientList *list)
foreach(const PixmapIdentifier & pixmapIdentifier, client) {
if (!daemon.contains(pixmapIdentifier)) {
// pixmap not found from daemon-side list, but exists in client-side list -> inconsistent state
- qDebug() << "ERROR:" << identifier << "- pixmap not found from daemon-side list:" << pixmapIdentifier.imageId << '(' << pixmapIdentifier.size << ')';
+ qWarning() << "ERROR:" << identifier << "- pixmap not found from daemon-side list:" << pixmapIdentifier.imageId << '(' << pixmapIdentifier.size << ')';
break;
}
}
@@ -408,11 +338,11 @@ bool Client::isDataConsistent(const M::MThemeDaemonProtocol::ClientList *list)
}
}
- // if we're registered, we shouldn't end up being here and vice versa
- return registered ? false : true;
+ // if we are registered, we shouldn't end up being here
+ return false;
}
-QString Client::getImageDirectory() const
+QString TestClient::getImageDirectory() const
{
return QString("meegotouch") + QDir::separator() +
QString(identifier) + QDir::separator() +
diff --git a/mthemedaemon/test/client.h b/mthemedaemon/test/client.h
index 01749c43..26f9b29f 100644
--- a/mthemedaemon/test/client.h
+++ b/mthemedaemon/test/client.h
@@ -29,8 +29,9 @@
#include "mthemedaemonclient.h"
-class Client;
+class TestClient;
class ClientManager;
+class MRemoteThemeDaemon;
class ClientThread : public QThread
{
@@ -46,11 +47,11 @@ private:
QString identifier;
};
-class Client : public QObject
+class TestClient : public QObject
{
Q_OBJECT
- static const int MAX_OPERATION_COUNT = 100;
+ static const int MAX_OPERATION_COUNT = 250;
static const int TASK_EXECUTION_INTERVAL = 50;
enum Task {
@@ -63,8 +64,8 @@ class Client : public QObject
};
public:
- Client(const QString &identifier);
- ~Client();
+ TestClient(const QString &identifier);
+ ~TestClient();
const QString& getId() const;
@@ -72,7 +73,7 @@ public:
void pixmapVerified(const QString& imageId, const QSize& size);
signals:
- void pixmapReady(const QString& theme, Client* client, quint32 handle, const QString&, const QSize&);
+ void pixmapReady(const QString& theme, TestClient* client, quint32 handle, const QString&, const QSize&);
protected:
@@ -81,27 +82,25 @@ protected:
void requestPixmap(M::MThemeDaemonProtocol::PixmapIdentifier &);
void releasePixmap(M::MThemeDaemonProtocol::PixmapIdentifier &);
void checkConsistency();
- M::MThemeDaemonProtocol::Packet processOnePacket();
private slots:
+ void pixmapChangedSlot(const QString &imageId, const QSize &size, Qt::HANDLE pixmapHandle);
+ void themeChangedSlot(const QStringList &themeInheritance, const QStringList& libraryNames);
void connected();
void disconnected();
void sendPacket();
- void readyRead();
private:
bool isDataConsistent(const M::MThemeDaemonProtocol::ClientList *reply);
void quit();
- QLocalSocket socket;
- QDataStream stream;
+ MRemoteThemeDaemon *daemon;
+
QSet<M::MThemeDaemonProtocol::PixmapIdentifier> requestedPixmaps;
QSet<M::MThemeDaemonProtocol::PixmapIdentifier> readyPixmaps;
QString identifier;
- bool registered;
int operationCount;
- quint64 packetsSent;
QString currentTheme;
QSemaphore waitVerify;
};
diff --git a/mthemedaemon/test/clientmanager.cpp b/mthemedaemon/test/clientmanager.cpp
index c83168cd..e7c0290f 100644
--- a/mthemedaemon/test/clientmanager.cpp
+++ b/mthemedaemon/test/clientmanager.cpp
@@ -163,9 +163,7 @@ void ClientManager::spawnClient()
clients.insert(client);
client->start();
-#ifdef PRINT_INFO_MESSAGES
- qDebug() << "INFO: ClientManager - Client started, number of active clients:" << clients.count();
-#endif
+ qDebug() << "INFO: ClientManager - Client" << client->getId() << "started, number of active clients:" << clients.count();
}
void ClientManager::start()
@@ -192,8 +190,6 @@ void ClientManager::stop()
void ClientManager::clientStarted()
{
- Client *client = static_cast<Client *>(sender());
- Q_UNUSED(client);
}
@@ -205,10 +201,8 @@ void ClientManager::clientFinished()
clients.remove(client);
client->exit();
client->wait();
+ qDebug() << "INFO: ClientManager - Client" << client->getId() << "finished, number of active clients:" << clients.count();
delete client;
-#ifdef PRINT_INFO_MESSAGES
- qDebug() << "INFO: ClientManager - Client finished, number of active clients:" << clients.count();
-#endif
if (shutdown) {
if (clients.count() == 0) {
qApp->quit();
@@ -220,7 +214,7 @@ void ClientManager::checkConsistency()
{
// check that themedaemon has not crashed
if (themedaemon.state() != QProcess::Running) {
- qDebug() << "ERROR: ClientManager (consistency check)- Themedaemon is not running";
+ qWarning() << "ERROR: ClientManager (consistency check)- Themedaemon is not running";
qDebug() << themedaemon.readAllStandardError();
qDebug() << themedaemon.readAllStandardOutput();
@@ -270,10 +264,10 @@ void ClientManager::changeThemeAndLocale()
#endif
}
-void ClientManager::pixmapReady(const QString& theme, Client* client, quint32 handle, const QString& imageId, const QSize& size)
+void ClientManager::pixmapReady(const QString& theme, TestClient* client, quint32 handle, const QString& imageId, const QSize& size)
{
if(!verifyPixmap(theme, client, handle, imageId, size)) {
- qDebug() << "ERROR:" << client->getId() << "- incorrect color found when verifying returned pixmap (" << imageId << ')';
+ qWarning() << "ERROR:" << client->getId() << "- incorrect color found when verifying returned pixmap (" << imageId << ')';
} else {
#ifdef PRINT_INFO_MESSAGES
qDebug() << "INFO:" << client->getId() << "- pixmap comparison OK (" << imageId << ')';
@@ -282,7 +276,7 @@ void ClientManager::pixmapReady(const QString& theme, Client* client, quint32 ha
client->pixmapVerified(imageId, size);
}
-bool ClientManager::verifyPixmap(const QString& theme, Client* client, quint32 handle, const QString& imageId, const QSize& size)
+bool ClientManager::verifyPixmap(const QString& theme, TestClient* client, quint32 handle, const QString& imageId, const QSize& size)
{
// this is what we got from daemon
QPixmap daemon = QPixmap::fromX11Pixmap(handle, QPixmap::ImplicitlyShared);
@@ -318,7 +312,7 @@ bool ClientManager::verifyPixmap(const QString& theme, Client* client, quint32 h
QSvgRenderer renderer(filename);
if(!renderer.isValid())
{
- qDebug() << "ERROR: Failed to construct SVG renderer for:" << filename;
+ qWarning() << "ERROR: Failed to construct SVG renderer for:" << filename;
return false;
}
// render pixmap
@@ -333,7 +327,7 @@ bool ClientManager::verifyPixmap(const QString& theme, Client* client, quint32 h
QDir imageDirectory = theme + QDir::separator() + client->getImageDirectory();
QString filename = imageDirectory.absolutePath() + QDir::separator() + imageId + ".png";
if(!clientPixmap.load(filename, "PNG"))
- qDebug() << "ERROR: Failed to construct PNG image:" << filename;
+ qWarning() << "ERROR: Failed to construct PNG image:" << filename;
}
// make sure that the pixel in the center of the pixmap is equal (these are always one-color images)
@@ -344,7 +338,7 @@ bool ClientManager::verifyPixmap(const QString& theme, Client* client, quint32 h
QRgb color2 = c.pixel(size.width() / 2, size.height() / 2);
if(color != color2) {
- qDebug() << "ERROR: Colors don't match:" << theme << QColor(color) << QColor(color2);
+ qWarning() << "ERROR: Colors don't match:" << theme << QColor(color) << QColor(color2);
return false;
}
diff --git a/mthemedaemon/test/clientmanager.h b/mthemedaemon/test/clientmanager.h
index 7b565f59..09589bbc 100644
--- a/mthemedaemon/test/clientmanager.h
+++ b/mthemedaemon/test/clientmanager.h
@@ -26,7 +26,7 @@
#include <QSize>
class ClientThread;
-class Client;
+class TestClient;
static const QString THEME_ROOT_DIRECTORY = QString("themes");
@@ -53,11 +53,11 @@ private slots:
void clientFinished();
void changeThemeAndLocale();
- void pixmapReady(const QString& theme, Client* client, quint32 handle, const QString& imageId, const QSize& size);
+ void pixmapReady(const QString& theme, TestClient* client, quint32 handle, const QString& imageId, const QSize& size);
private:
void cleanup();
- bool verifyPixmap(const QString& theme, Client* client, quint32 handle, const QString& imageId, const QSize& size);
+ bool verifyPixmap(const QString& theme, TestClient* client, quint32 handle, const QString& imageId, const QSize& size);
QStringList locales;
QSet<ClientThread *> clients;
diff --git a/mthemedaemon/test/main.cpp b/mthemedaemon/test/main.cpp
index 1de670cb..15698560 100644
--- a/mthemedaemon/test/main.cpp
+++ b/mthemedaemon/test/main.cpp
@@ -27,17 +27,14 @@
int main(int argc, char **argv)
{
+ srand(time(0));
QApplication app(argc, argv);
-#ifdef HAVE_GCONF
const QString themeName = "theme_one";
- QDir themeDirectory(THEME_ROOT_DIRECTORY + '/' + themeName);
- if (themeDirectory.exists()) {
- MGConfItem theme("/meegotouch/theme/name");
- theme.set(themeName);
- }
-#endif
+ MGConfItem theme("/meegotouch/theme/name");
+ theme.set(themeName);
+ bool result = false;
QProcess td;
td.start("./testdaemon/testdaemon", QStringList());
// start theme daemon
@@ -51,15 +48,17 @@ int main(int argc, char **argv)
keyWaiter.start();
// event loop
- int result = app.exec();
+ result = app.exec();
// stop theme daemon
if (td.state() == QProcess::Running) {
td.close();
}
- return result;
+ } else {
+ qWarning() << "Theme daemon failed to start";
}
- qDebug() << "Theme daemon failed to start";
- return 0;
+ theme.unset();
+
+ return result;
}
diff --git a/mthemedaemon/test/mthemedaemontest.pro b/mthemedaemon/test/mthemedaemontest.pro
index 69c9b5a0..a5fa5b54 100644
--- a/mthemedaemon/test/mthemedaemontest.pro
+++ b/mthemedaemon/test/mthemedaemontest.pro
@@ -8,15 +8,12 @@ DEPENDPATH += .
QT += svg network
-#DEFINES += PRINT_INFO_MESSAGES
-
-# Check for mixing of const and non-const iterators,
-# which can cause problems when built with some compilers:
-DEFINES += QT_STRICT_ITERATORS
-
# override theme directory
DEFINES += IMAGESDIR=\\\"./images\\\"
+# we want to be able to access private classes
+DEFINES += UNIT_TEST
+
!win32:CONFIG += link_pkgconfig
PKGCONFIG += gconf-2.0
@@ -24,6 +21,7 @@ PKGCONFIG += gconf-2.0
SOURCES += main.cpp \
clientmanager.cpp \
client.cpp \
+ ../../src/corelib/theme/mremotethemedaemon.cpp \
../../src/corelib/theme/mthemedaemon.cpp \
../../src/corelib/theme/mcommonpixmaps.cpp \
../../src/corelib/theme/mimagedirectory.cpp \
@@ -37,6 +35,7 @@ SOURCES += main.cpp \
HEADERS += clientmanager.h \
client.h \
../keypresswaiter.h \
+ ../../src/corelib/theme/mremotethemedaemon.h \
../../src/corelib/theme/imthemedaemon.h \
../../src/corelib/theme/mthemedaemon.h \
../../src/corelib/theme/mcommonpixmaps.h \
diff --git a/mthemedaemon/test/stresstest.pro b/mthemedaemon/test/stresstest.pro
new file mode 100644
index 00000000..f43bb22d
--- /dev/null
+++ b/mthemedaemon/test/stresstest.pro
@@ -0,0 +1,13 @@
+TEMPLATE = subdirs
+
+#DEFINES += PRINT_INFO_MESSAGES
+
+# Check for mixing of const and non-const iterators,
+# which can cause problems when built with some compilers:
+DEFINES += QT_STRICT_ITERATORS
+
+# enable QString optimizations
+DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
+
+SUBDIRS = mthemedaemontest.pro \
+ testdaemon
diff --git a/mthemedaemon/test/testdaemon/testdaemon.pro b/mthemedaemon/test/testdaemon/testdaemon.pro
index a3a98663..675add11 100644
--- a/mthemedaemon/test/testdaemon/testdaemon.pro
+++ b/mthemedaemon/test/testdaemon/testdaemon.pro
@@ -1,3 +1,5 @@
+include(../../../mkspecs/common.pri)
+
INCLUDEPATH += . ../../../src/include ../../../src ../../../src/corelib/core ../../../src/corelib/
TEMPLATE = app
@@ -8,7 +10,8 @@ QT += svg network
#DEFINES += MTHEME_PRINT_DEBUG
#DEFINES += CLOSE_ON_ENTER
-DEFINES += THEMEDIR=\\\"\"themes\"\\\"
+
+DEFINES ~= s/THEMEDIR.*/THEMEDIR=\\\"\"themes\"\\\"/
# enable QString optimizations
DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
diff --git a/mthemedaemon/test/themes/base/index.theme b/mthemedaemon/test/themes/base/index.theme
index 2c5cca43..44064206 100644
--- a/mthemedaemon/test/themes/base/index.theme
+++ b/mthemedaemon/test/themes/base/index.theme
@@ -1,7 +1,7 @@
[Desktop Entry]
-Type=X-DUI-Metatheme
-Name=Base
+Type=X-MeeGoTouch-Metatheme
+Name=Base Theme
Encoding=UTF-8
-[X-DUI-Metatheme]
-X-Visible=false
+[X-MeeGoTouch-Metatheme]
+X-Visible=true
diff --git a/mthemedaemon/test/themes/base/m/libduicore/style/libdui.css b/mthemedaemon/test/themes/base/m/libduicore/style/libdui.css
deleted file mode 100644
index 4bd8276f..00000000
--- a/mthemedaemon/test/themes/base/m/libduicore/style/libdui.css
+++ /dev/null
@@ -1 +0,0 @@
-// empty file
diff --git a/mthemedaemon/test/themes/base/meegotouch/libmeegotouchcore/style/dummy b/mthemedaemon/test/themes/base/meegotouch/libmeegotouchcore/style/dummy
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mthemedaemon/test/themes/base/meegotouch/libmeegotouchcore/style/dummy
diff --git a/mthemedaemon/test/themes/devel/index.theme b/mthemedaemon/test/themes/devel/index.theme
new file mode 100644
index 00000000..c1a1ffb9
--- /dev/null
+++ b/mthemedaemon/test/themes/devel/index.theme
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=X-MeeGoTouch-Metatheme
+Name=Devel Theme
+Encoding=UTF-8
+
+[X-MeeGoTouch-Metatheme]
+X-Inherits=base
+X-Visible=true
diff --git a/mthemedaemon/test/themes/devel/meegotouch/libmeegotouchcore/style/dummy b/mthemedaemon/test/themes/devel/meegotouch/libmeegotouchcore/style/dummy
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mthemedaemon/test/themes/devel/meegotouch/libmeegotouchcore/style/dummy
diff --git a/mthemedaemon/test/themes/theme_one/index.theme b/mthemedaemon/test/themes/theme_one/index.theme
deleted file mode 100644
index 1949ed97..00000000
--- a/mthemedaemon/test/themes/theme_one/index.theme
+++ /dev/null
@@ -1,8 +0,0 @@
-[Desktop Entry]
-Type=X-DUI-Metatheme
-Name=One
-Encoding=UTF-8
-
-[X-DUI-Metatheme]
-X-Visible=true
-X-Inherits=base
diff --git a/mthemedaemon/test/themes/theme_one/m/constants.ini b/mthemedaemon/test/themes/theme_one/m/constants.ini
deleted file mode 100644
index 3599b2b3..00000000
--- a/mthemedaemon/test/themes/theme_one/m/constants.ini
+++ /dev/null
@@ -1,34 +0,0 @@
-[Palette]
-COLOR_FOREGROUND = #000000 ;text color
-COLOR_SECONDARY_FOREGROUND = #cc6633 ;secondary text
-COLOR_BACKGROUND = #ffffff ;background
-
-;reversed elements
-COLOR_INVERTED_FOREGROUND = #ffffff ;text color
-COLOR_INVERTED_SECONDARY_FOREGROUND = #CC6633 ;secondary text
-COLOR_INVERTED_BACKGROUND = #FFFFFF ;background
-
-;selection
-COLOR_SELECT = #CC6633 ;selected item background
-
-;notification colors
-COLOR_WARNING = #CC0000 ;"red" attention color
-COLOR_ATTENTION = #CC9900 ;"yellow" attention color
-COLOR_NOTIFICATION = #C3F500 ;"green" attention color
-
-COLOR_LINK = #3465a4;
-COLOR_LINK_ACTIVE = #f5bf00;
-
-COLOR_ACCENT1 = #aad400 ;crayon #1 for applications
-COLOR_ACCENT2 = #69bfde ;crayon #2 for applications
-COLOR_ACCENT3 = #ff9955 ;crayon #3 for applications
-COLOR_ACCENT4 = #de87cd ;crayon #4 for applications
-COLOR_ACCENT5 = #d8b427 ;crayon #5 for applications
-
-[Fonts]
-FONT_XLARGE = "Nokia Sans" 3.2mm ;32px
-FONT_LARGE = "Nokia Sans" 2.8mm ;28px
-FONT_DEFAULT = "Nokia Sans" 2.4mm ;24px
-FONT_SMALL = "Nokia Sans" 2.0mm ;20px
-FONT_XSMALL = "Nokia Sans" 1.6mm ;16px
-
diff --git a/mthemedaemon/test/themes/theme_one/m/locale/fi/constants.ini b/mthemedaemon/test/themes/theme_one/m/locale/fi/constants.ini
deleted file mode 100644
index 73dd058d..00000000
--- a/mthemedaemon/test/themes/theme_one/m/locale/fi/constants.ini
+++ /dev/null
@@ -1,34 +0,0 @@
-[Palette]
-COLOR_FOREGROUND = #ffffff ;text color
-COLOR_SECONDARY_FOREGROUND = #cc6633 ;secondary text
-COLOR_BACKGROUND = #000000 ;background
-
-;reversed elements
-COLOR_INVERTED_FOREGROUND = #000000 ;text color
-COLOR_INVERTED_SECONDARY_FOREGROUND = #CC6633 ;secondary text
-COLOR_INVERTED_BACKGROUND = #FFFFFF ;background
-
-;selection
-COLOR_SELECT = #CC6633 ;selected item background
-
-;notification colors
-COLOR_WARNING = #CC0000 ;"red" attention color
-COLOR_ATTENTION = #CC9900 ;"yellow" attention color
-COLOR_NOTIFICATION = #C3F500 ;"green" attention color
-
-COLOR_LINK = #3465a4;
-COLOR_LINK_ACTIVE = #f5bf00;
-
-COLOR_ACCENT1 = #aad400 ;crayon #1 for applications
-COLOR_ACCENT2 = #69bfde ;crayon #2 for applications
-COLOR_ACCENT3 = #ff9955 ;crayon #3 for applications
-COLOR_ACCENT4 = #de87cd ;crayon #4 for applications
-COLOR_ACCENT5 = #d8b427 ;crayon #5 for applications
-
-[Fonts]
-FONT_XLARGE = "Arial" 3.2mm ;32px
-FONT_LARGE = "Arial" 2.8mm ;28px
-FONT_DEFAULT = "Arial" 2.4mm ;24px
-FONT_SMALL = "Arial" 2.0mm ;20px
-FONT_XSMALL = "Arial" 1.6mm ;16px
-
diff --git a/src/corelib/theme/mremotethemedaemon.h b/src/corelib/theme/mremotethemedaemon.h
index a125859d..628d9c8e 100644
--- a/src/corelib/theme/mremotethemedaemon.h
+++ b/src/corelib/theme/mremotethemedaemon.h
@@ -51,6 +51,9 @@ public:
virtual bool hasPendingRequests() const;
private:
+#ifdef UNIT_TEST
+ friend class TestClient;
+#endif
Q_DECLARE_PRIVATE(MRemoteThemeDaemon)
MRemoteThemeDaemonPrivate *const d_ptr;