Skip to content
Permalink
Browse files

Make existing ModelTest users use the new ENABLE_MODELTEST define

  • Loading branch information
Sandro Santilli
Sandro Santilli committed Dec 19, 2014
1 parent 8f35a27 commit ddb406d944ae7ba02a783831fee5f51e092679f4
@@ -91,8 +91,9 @@
#include <QProgressDialog>
#include <QShortcut>

//For model testing
//#include "modeltest.h"
#ifdef ENABLE_MODELTEST
#include "modeltest.h"
#endif

// sort function for QList<QAction*>, e.g. menu listings
static bool cmpByText_( QAction* a, QAction* b )
@@ -554,8 +555,9 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
//items tree widget
mItemsTreeView = new QTreeView( mItemsDock );
mItemsTreeView->setModel( mComposition->itemsModel() );
//for testing:
//new ModelTest( mComposition->itemsModel(), this );
#ifdef ENABLE_MODELTEST
new ModelTest( mComposition->itemsModel(), this );
#endif

mItemsTreeView->setColumnWidth( 0, 30 );
mItemsTreeView->setColumnWidth( 1, 30 );
@@ -599,18 +599,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsexpressionselectiondialogbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgssublayersdialogbase.h
)

# ModelTest
#SET(MODELTEST_SRCS
# ../../tests/qt_modeltest/modeltest.cpp
# ../../tests/qt_modeltest/dynamictreemodel.cpp
#)
#SET(MODELTEST_MOC_HDRS
# ../../tests/qt_modeltest/modeltest.h
# ../../tests/qt_modeltest/dynamictreemodel.h
#)
#QT4_WRAP_CPP(MODELTEST_MOC_SRCS ${MODELTEST_MOC_HDRS})
#INCLUDE_DIRECTORIES(../../tests/qt_modeltest)

IF(ENABLE_MODELTEST)
INCLUDE_DIRECTORIES(../../tests/qt_modeltest)
ENDIF(ENABLE_MODELTEST)

INCLUDE_DIRECTORIES(
${QT_QTUITOOLS_INCLUDE_DIR}
@@ -668,7 +659,6 @@ ENDIF(MSVC)

ADD_LIBRARY(qgis_gui SHARED
${QGIS_GUI_SRCS} ${QGIS_GUI_MOC_SRCS} ${QGIS_GUI_HDRS} ${QGIS_GUI_MOC_HDRS}
#${MODELTEST_SRCS} ${MODELTEST_MOC_SRCS} # for ModelTest
)

IF(NOT APPLE)
@@ -703,7 +693,6 @@ TARGET_LINK_LIBRARIES(qgis_gui
${QT_QTUITOOLS_LIBRARY}
${QWT_LIBRARY}
${QSCINTILLA_LIBRARY}
#${QT_QTTEST_LIBRARY} # for ModelTest
)

IF(WIN32)
@@ -24,16 +24,18 @@
#include <QClipboard>
#include <QKeyEvent>

//For model testing
//#include "modeltest.h"
#ifdef ENABLE_MODELTEST
#include "modeltest.h"
#endif

QgsColorSchemeList::QgsColorSchemeList( QWidget *parent, QgsColorScheme *scheme, const QString &context, const QColor &baseColor )
: QTreeView( parent )
, mScheme( scheme )
{
mModel = new QgsColorSchemeModel( scheme, context, baseColor, this );
//for testing:
//new ModelTest( mModel, this );
#ifdef ENABLE_MODELTEST
new ModelTest( mModel, this );
#endif
setModel( mModel );

mSwatchDelegate = new QgsColorSwatchDelegate( this );
@@ -34,7 +34,9 @@
#include <QVBoxLayout>
#include <QMessageBox>

//#include "modeltest.h"
#ifdef ENABLE_MODELTEST
#include "modeltest.h"
#endif

QgsRendererV2Widget* QgsRuleBasedRendererV2Widget::create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer )
{
@@ -64,7 +66,9 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
setupUi( this );

mModel = new QgsRuleBasedRendererV2Model( mRenderer );
//new ModelTest( mModel, this ); // for model validity checking
#ifdef ENABLE_MODELTEST
new ModelTest( mModel, this ); // for model validity checking
#endif
viewRules->setModel( mModel );

mDeleteAction = new QAction( tr( "Remove Rule" ), this );

2 comments on commit ddb406d

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Dec 20, 2014

@strk what do you think about removing ENABLE_MODELTEST and instead including model test if ENABLE_TESTS is on? That way it would be safe for unit tests to include model test, which would be very handy.

@strk

This comment has been minimized.

Copy link
Contributor

@strk strk replied Dec 22, 2014

I guess you might want to enable build of tests (ENABLE_TESTS) w/out changing the application binary.
ENABLE_MODELTEST changes the application by adding instrumentation (leaky, btw).

Please sign in to comment.
You can’t perform that action at this time.