mirror of https://github.com/cutefishos/appmotor
New: Unit tests for WRTBooster added. Cleaned up tests/unittests/tests.xml.
Details: Removed duplicated entries in tests.xml, presteps removed since they didn't have any effect.pull/1/head
parent
707457b879
commit
97120632e9
@ -0,0 +1,28 @@
|
||||
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcher)
|
||||
|
||||
# Set sources
|
||||
set(SRC ut_wrtbooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/connection.cpp
|
||||
${LAUNCHER}/logger.cpp ${LAUNCHER}/wrtbooster.cpp)
|
||||
|
||||
# Set moc headers
|
||||
set(MOC_HDRS ut_wrtbooster.h)
|
||||
|
||||
# Run moc
|
||||
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
|
||||
|
||||
# Enable test library
|
||||
set(QT_USE_QTTEST TRUE)
|
||||
|
||||
# Set include paths
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
|
||||
|
||||
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS})
|
||||
|
||||
# Enable Qt (may not be needed, because already defined on higher level)
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
add_executable(ut_wrtbooster ${SRC} ${MOC_SRC} )
|
||||
|
||||
# Install
|
||||
install(PROGRAMS ut_wrtbooster DESTINATION /usr/share/applauncherd-tests/)
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (directui@nokia.com)
|
||||
**
|
||||
** This file is part of applauncherd
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at directui@nokia.com.
|
||||
**
|
||||
** 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 "ut_wrtbooster.h"
|
||||
#include "wrtbooster.h"
|
||||
|
||||
#ifdef HAVE_MCOMPONENTCACHE
|
||||
#include <MComponentCache>
|
||||
#endif
|
||||
|
||||
Ut_WRTBooster::Ut_WRTBooster() :
|
||||
m_subject(new WRTBooster)
|
||||
{}
|
||||
|
||||
Ut_WRTBooster::~Ut_WRTBooster()
|
||||
{}
|
||||
|
||||
void Ut_WRTBooster::initTestCase()
|
||||
{}
|
||||
|
||||
void Ut_WRTBooster::cleanupTestCase()
|
||||
{}
|
||||
|
||||
void Ut_WRTBooster::testSocketName()
|
||||
{
|
||||
QVERIFY(WRTBooster::socketName() == WRTBooster::m_socketId);
|
||||
QVERIFY(m_subject->socketId() == WRTBooster::m_socketId);
|
||||
}
|
||||
|
||||
void Ut_WRTBooster::testType()
|
||||
{
|
||||
QVERIFY(WRTBooster::type() == 'w');
|
||||
QVERIFY(m_subject->boosterType() == 'w');
|
||||
}
|
||||
|
||||
void Ut_WRTBooster::testSetProcessId()
|
||||
{
|
||||
WRTBooster::setProcessId(123);
|
||||
QVERIFY(WRTBooster::processId() == 123);
|
||||
}
|
||||
|
||||
void Ut_WRTBooster::testPreload()
|
||||
{
|
||||
#ifdef HAVE_MCOMPONENTCACHE
|
||||
|
||||
m_subject->preload();
|
||||
|
||||
const char * argv[] = {"foo"};
|
||||
int argc = 1;
|
||||
|
||||
QVERIFY(MComponentCache::mApplication(argc, const_cast<char **>(argv)));
|
||||
QVERIFY(MComponentCache::mApplicationWindow());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(Ut_WRTBooster);
|
||||
@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (directui@nokia.com)
|
||||
**
|
||||
** This file is part of applauncherd
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at directui@nokia.com.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef UT_WRTBOOSTER_H
|
||||
#define UT_WRTBOOSTER_H
|
||||
|
||||
#include<QtTest/QtTest>
|
||||
#include<QObject>
|
||||
|
||||
#include <tr1/memory>
|
||||
|
||||
#define UNIT_TEST
|
||||
|
||||
class WRTBooster;
|
||||
|
||||
class Ut_WRTBooster : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Ut_WRTBooster();
|
||||
virtual ~Ut_WRTBooster();
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testSocketName();
|
||||
void testType();
|
||||
void testSetProcessId();
|
||||
void testPreload();
|
||||
|
||||
private:
|
||||
std::tr1::shared_ptr<WRTBooster> m_subject;
|
||||
};
|
||||
|
||||
#endif // UT_WRTBOOSTER_H
|
||||
Loading…
Reference in New Issue