massif-visualizer: adjust tests

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-12-01 05:05:23 +00:00
parent 43d4802e1b
commit 21133566c6
3 changed files with 14 additions and 11 deletions

View file

@ -2,17 +2,19 @@ set(datamodeltest_SRCS
datamodeltest.cpp datamodeltest.cpp
modeltest.cpp modeltest.cpp
) )
kde4_add_unit_test(datamodeltest ${datamodeltest_SRCS}) kde4_add_test(datamodeltest ${datamodeltest_SRCS})
target_link_libraries(datamodeltest LINK_PRIVATE target_link_libraries(datamodeltest LINK_PRIVATE
mv-massifdata mv-massifdata
mv-visualizer mv-visualizer
${QT_QTTEST_LIBRARY} ${QT_QTTEST_LIBRARY}
${KDE4_KIO_LIBS}
) )
kde4_add_executable(massifparser massifparser.cpp) add_executable(massifparser massifparser.cpp)
target_link_libraries(massifparser LINK_PRIVATE target_link_libraries(massifparser LINK_PRIVATE
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}
${KDE4_KDECORE_LIBS} ${KDE4_KDECORE_LIBS}
${KDE4_KIO_LIBS}
mv-massifdata mv-massifdata
) )

View file

@ -25,6 +25,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QScopedPointer>
#include <QDebug> #include <QDebug>
#include "massifdata/parser.h" #include "massifdata/parser.h"

View file

@ -416,27 +416,27 @@ void ModelTest::data()
// General Purpose roles that should return a QString // General Purpose roles that should return a QString
QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole ); QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
if ( variant.isValid() ) { if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) ); Q_ASSERT ( variant.canConvert<QString>() );
} }
variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole ); variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
if ( variant.isValid() ) { if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) ); Q_ASSERT ( variant.canConvert<QString>() );
} }
variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole ); variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
if ( variant.isValid() ) { if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) ); Q_ASSERT ( variant.canConvert<QString>() );
} }
// General Purpose roles that should return a QSize // General Purpose roles that should return a QSize
variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole ); variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
if ( variant.isValid() ) { if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QSize> ( variant ) ); Q_ASSERT ( variant.canConvert<QSize>() );
} }
// General Purpose roles that should return a QFont // General Purpose roles that should return a QFont
QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole ); QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
if ( fontVariant.isValid() ) { if ( fontVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QFont> ( fontVariant ) ); Q_ASSERT ( fontVariant.canConvert<QFont>() );
} }
// Check that the alignment is one we know about // Check that the alignment is one we know about
@ -447,14 +447,14 @@ void ModelTest::data()
} }
// General Purpose roles that should return a QColor // General Purpose roles that should return a QColor
QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole ); QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundRole );
if ( colorVariant.isValid() ) { if ( colorVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) ); Q_ASSERT ( colorVariant.canConvert<QColor>() );
} }
colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole ); colorVariant = model->data ( model->index ( 0, 0 ), Qt::ForegroundRole );
if ( colorVariant.isValid() ) { if ( colorVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) ); Q_ASSERT ( colorVariant.canConvert<QColor>() );
} }
// Check that the "check state" is one we know about. // Check that the "check state" is one we know about.