Skip to content

Commit

Permalink
Make existing ModelTest users use the new ENABLE_MODELTEST define
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Santilli committed Dec 19, 2014
1 parent 8f35a27 commit ddb406d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
10 changes: 6 additions & 4 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
Expand Down
17 changes: 3 additions & 14 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -703,7 +693,6 @@ TARGET_LINK_LIBRARIES(qgis_gui
${QT_QTUITOOLS_LIBRARY}
${QWT_LIBRARY}
${QSCINTILLA_LIBRARY}
#${QT_QTTEST_LIBRARY} # for ModelTest
)

IF(WIN32)
Expand Down
10 changes: 6 additions & 4 deletions src/gui/qgscolorschemelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
8 changes: 6 additions & 2 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 );
Expand Down

2 comments on commit ddb406d

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Contributor

@strk strk commented on ddb406d Dec 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.