mirror of https://github.com/cutefishos/appmotor
				
				
				
			New: Unit tests for EBooster added.
							parent
							
								
									28d852e015
								
							
						
					
					
						commit
						67edb111cf
					
				@ -0,0 +1,32 @@
 | 
			
		||||
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcherlib)
 | 
			
		||||
set(EBOOSTER ${CMAKE_HOME_DIRECTORY}/src/ebooster)
 | 
			
		||||
set(COMMON "${CMAKE_HOME_DIRECTORY}/src/common")
 | 
			
		||||
 | 
			
		||||
# Set sources
 | 
			
		||||
set(SRC ut_ebooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
 | 
			
		||||
${LAUNCHER}/connection.cpp
 | 
			
		||||
${LAUNCHER}/logger.cpp ${EBOOSTER}/ebooster.cpp
 | 
			
		||||
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
 | 
			
		||||
 | 
			
		||||
# Set moc headers
 | 
			
		||||
set(MOC_HDRS ut_ebooster.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} ${EBOOSTER})
 | 
			
		||||
 | 
			
		||||
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_ebooster ${SRC} ${MOC_SRC} )
 | 
			
		||||
 | 
			
		||||
# Install
 | 
			
		||||
install(PROGRAMS ut_ebooster DESTINATION /usr/share/applauncherd-tests/)
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,53 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** 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_ebooster.h"
 | 
			
		||||
#include "ebooster.h"
 | 
			
		||||
 | 
			
		||||
Ut_EBooster::Ut_EBooster() :
 | 
			
		||||
    m_subject(new EBooster)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
Ut_EBooster::~Ut_EBooster()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void Ut_EBooster::initTestCase()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void Ut_EBooster::cleanupTestCase()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void Ut_EBooster::testSocketName()
 | 
			
		||||
{
 | 
			
		||||
    QVERIFY(EBooster::socketName() == EBooster::m_socketId);
 | 
			
		||||
    QVERIFY(m_subject->socketId() == EBooster::m_socketId);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Ut_EBooster::testType()
 | 
			
		||||
{
 | 
			
		||||
    QVERIFY(EBooster::type() == 'e');
 | 
			
		||||
    QVERIFY(m_subject->boosterType() == 'e');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Ut_EBooster::testPreload()
 | 
			
		||||
{
 | 
			
		||||
    QVERIFY(m_subject->preload());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QTEST_APPLESS_MAIN(Ut_EBooster);
 | 
			
		||||
@ -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_EBOOSTER_H
 | 
			
		||||
#define UT_EBOOSTER_H
 | 
			
		||||
 | 
			
		||||
#include<QtTest/QtTest>
 | 
			
		||||
#include<QObject>
 | 
			
		||||
 | 
			
		||||
#include <tr1/memory>
 | 
			
		||||
 | 
			
		||||
#define UNIT_TEST
 | 
			
		||||
 | 
			
		||||
class EBooster;
 | 
			
		||||
 | 
			
		||||
class Ut_EBooster : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    Ut_EBooster();
 | 
			
		||||
    virtual ~Ut_EBooster();
 | 
			
		||||
 | 
			
		||||
private Q_SLOTS:
 | 
			
		||||
    void initTestCase();
 | 
			
		||||
    void cleanupTestCase();
 | 
			
		||||
    void testSocketName();
 | 
			
		||||
    void testType();
 | 
			
		||||
    void testPreload();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    std::tr1::shared_ptr<EBooster> m_subject;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // UT_EBOOSTER_H
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue