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
Jussi Lind 15 years ago
parent 707457b879
commit 97120632e9

@ -2,6 +2,7 @@ add_subdirectory(ut_daemon)
add_subdirectory(ut_booster)
add_subdirectory(ut_mbooster)
add_subdirectory(ut_qtbooster)
add_subdirectory(ut_wrtbooster)
add_subdirectory(ut_connection)
install(FILES tests.xml DESTINATION /usr/share/applauncherd-tests)

@ -6,11 +6,6 @@
<suite name="applauncherd-tests" domain="Application framework">
<set name="launcher-tests" description="Basic launcher unit tests" feature="AF Basic Launcher daemon support" requirement="300168" >
<pre_steps>
<step>export DISPLAY=:0</step>
<step>source /tmp/session_bus_address.user</step>
<!-- step>other pre steps</step -->
</pre_steps>
<case name="Daemon" type="Functional" description="Unit tests for Daemon class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_daemon</step>
@ -29,43 +24,24 @@
</get-->
</set>
<set name="mbooster-tests" description="MBooster unit tests" feature="AF MBooster for Launcher daemon" requirement="300195" >
<pre_steps>
<step>export DISPLAY=:0</step>
<step>source /tmp/session_bus_address.user</step>
<!-- step>other pre steps</step -->
</pre_steps>
<case name="MBooster" type="Functional" description="Unit tests for MBooster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_mbooster</step>
</case>
<set name="booster-tests" description="Booster unit tests" feature="AF MBooster for Launcher daemon" requirement="300195" >
<case name="Booster" type="Functional" description="Unit tests for Booster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_booster</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
<set name="qtbooster-tests" description="QtBooster unit tests" feature="AF Launcher daemon support for Plain Qt applications" requirement="421032" >
<pre_steps>
<step>export DISPLAY=:0</step>
<step>source /tmp/session_bus_address.user</step>
<!-- step>other pre steps</step -->
</pre_steps>
<case name="MBooster" type="Functional" description="Unit tests for MBooster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_mbooster</step>
</case>
<case name="QtBooster" type="Functional" description="Unit tests for QtBooster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_qtbooster</step>
</case>
<case name="WRTBooster" type="Functional" description="Unit tests for WRTBooster class" level="Component" timeout="20">
<step expected_result="0">source /tmp/session_bus_address.user &amp;&amp; DISPLAY=:0 /usr/share/applauncherd-tests/ut_wrtbooster</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>

@ -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…
Cancel
Save