Changes: Unit tests for the qdeclarativebooster.

pull/1/head
Pertti Kellomäki 15 years ago committed by Antti Kervinen
parent 61a468e4fb
commit c12ae5a2c0

@ -3,6 +3,7 @@ usr/share/applauncherd-tests/ut_booster
usr/share/applauncherd-tests/ut_boosterfactory
usr/share/applauncherd-tests/ut_daemon
usr/share/applauncherd-tests/ut_connection
usr/share/applauncherd-tests/ut_dbooster
usr/share/applauncherd-tests/ut_mbooster
usr/share/applauncherd-tests/ut_qtbooster
usr/share/applauncherd-tests/ut_socketmanager

@ -2,6 +2,7 @@ add_subdirectory(ut_booster)
add_subdirectory(ut_boosterfactory)
add_subdirectory(ut_connection)
add_subdirectory(ut_daemon)
add_subdirectory(ut_dbooster)
add_subdirectory(ut_mbooster)
add_subdirectory(ut_qtbooster)
add_subdirectory(ut_socketmanager)

@ -0,0 +1,31 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcherlib)
set(DBOOSTER ${CMAKE_HOME_DIRECTORY}/src/qdeclarativebooster)
# Set sources
set(SRC ut_dbooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
${LAUNCHER}/connection.cpp
${LAUNCHER}/logger.cpp ${DBOOSTER}/qdeclarativebooster.cpp
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
# Set moc headers
set(MOC_HDRS ut_dbooster.h ${DBOOSTER}/qdeclarativebooster.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} ${DBOOSTER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS} "-L${CMAKE_SOURCE_DIR}/src/qdeclarativebooster -lqdeclarativeboostercache")
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})
add_executable(ut_dbooster ${SRC} ${MOC_SRC} )
# Install
install(PROGRAMS ut_dbooster DESTINATION /usr/share/applauncherd-tests/)

@ -0,0 +1,61 @@
/***************************************************************************
**
** Copyright (C) 2011 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_dbooster.h"
#include "qdeclarativebooster.h"
#include "qdeclarativeboostercache.h"
Ut_DBooster::Ut_DBooster() :
m_subject(new QDeclarativeBooster)
{}
Ut_DBooster::~Ut_DBooster()
{}
void Ut_DBooster::initTestCase()
{}
void Ut_DBooster::cleanupTestCase()
{}
void Ut_DBooster::testSocketName()
{
QVERIFY(QDeclarativeBooster::socketName() == QDeclarativeBooster::m_socketId);
QVERIFY(m_subject->socketId() == QDeclarativeBooster::m_socketId);
}
void Ut_DBooster::testType()
{
QVERIFY(QDeclarativeBooster::type() == 'd');
QVERIFY(m_subject->boosterType() == 'd');
}
void Ut_DBooster::testPreload()
{
m_subject->preload();
const char * argv[] = {"foo"};
int argc = 1;
QVERIFY(QDeclarativeBoosterCache::qApplication(argc, const_cast<char **>(argv)));
QVERIFY(QDeclarativeBoosterCache::qDeclarativeView());
}
QTEST_APPLESS_MAIN(Ut_DBooster);

@ -0,0 +1,51 @@
/***************************************************************************
**
** Copyright (C) 2011 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_DBOOSTER_H
#define UT_DBOOSTER_H
#include<QtTest/QtTest>
#include<QObject>
#include <tr1/memory>
#define UNIT_TEST
class QDeclarativeBooster;
class Ut_DBooster : public QObject
{
Q_OBJECT
public:
Ut_DBooster();
virtual ~Ut_DBooster();
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void testSocketName();
void testType();
void testPreload();
private:
std::tr1::shared_ptr<QDeclarativeBooster> m_subject;
};
#endif // UT_DBOOSTER_H
Loading…
Cancel
Save