Skip to content

Commit

Permalink
Restore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 4, 2022
1 parent f27d712 commit 5aeac53
Show file tree
Hide file tree
Showing 7 changed files with 418 additions and 370 deletions.
5 changes: 4 additions & 1 deletion src/app/gps/qgsappgpsdigitizing.h
Expand Up @@ -23,6 +23,7 @@
#include "qgspointxy.h"
#include "qgscoordinatetransform.h"
#include "qgsdistancearea.h"
#include "qgis_app.h"

class QgsAppGpsConnection;
class QgsMapCanvas;
Expand All @@ -32,7 +33,7 @@ class QgsGpsInformation;
class QgsVectorLayer;
class QTimer;

class QgsAppGpsDigitizing: public QObject
class APP_EXPORT QgsAppGpsDigitizing: public QObject
{
Q_OBJECT

Expand Down Expand Up @@ -106,6 +107,8 @@ class QgsAppGpsDigitizing: public QObject
//! Temporary storage of preferred fields
QMap<QString, QString> mPreferredTimestampFields;
QString mTimestampField;

friend class TestQgsGpsIntegration;
};

#endif // QGSAPPGPSDIGITIZING
13 changes: 12 additions & 1 deletion src/app/gps/qgsappgpssettingsmenu.cpp
Expand Up @@ -244,20 +244,31 @@ void QgsAppGpsSettingsMenu::timeStampMenuAboutToShow()
mFieldProxyModel->sourceFieldModel()->setLayer( vlayer );

mTimeStampFieldMenu->clear();
bool foundPreviousField = false;
for ( int row = 0; row < mFieldProxyModel->rowCount(); ++row )
{
QAction *fieldAction = new QAction( mFieldProxyModel->data( mFieldProxyModel->index( row, 0 ) ).toString(), this );
fieldAction->setIcon( mFieldProxyModel->data( mFieldProxyModel->index( row, 0 ), Qt::DecorationRole ).value< QIcon >() );
const QString fieldName = mFieldProxyModel->data( mFieldProxyModel->index( row, 0 ), QgsFieldModel::FieldNameRole ).toString();
fieldAction->setData( fieldName );
fieldAction->setCheckable( true );
fieldAction->setChecked( mCurrentTimeStampField == fieldName );
if ( mCurrentTimeStampField == fieldName )
{
foundPreviousField = true;
fieldAction->setChecked( mCurrentTimeStampField == fieldName );
}
connect( fieldAction, &QAction::triggered, this, [ = ]()
{
mCurrentTimeStampField = fieldName;
emit timeStampDestinationChanged( fieldName );
} );
mTimeStampFieldMenu->addAction( fieldAction );
}

if ( !foundPreviousField )
{
mTimeStampFieldMenu->actions().at( 0 )->setChecked( true );
mCurrentTimeStampField.clear();
}
}

5 changes: 4 additions & 1 deletion src/app/gps/qgsappgpssettingsmenu.h
Expand Up @@ -18,6 +18,7 @@

#include <QMenu>
#include <QWidgetAction>
#include "qgis_app.h"

class QRadioButton;
class QgsFieldProxyModel;
Expand All @@ -41,7 +42,7 @@ class QgsGpsMapRotationAction: public QWidgetAction

};

class QgsAppGpsSettingsMenu : public QMenu
class APP_EXPORT QgsAppGpsSettingsMenu : public QMenu
{
Q_OBJECT

Expand Down Expand Up @@ -98,6 +99,8 @@ class QgsAppGpsSettingsMenu : public QMenu
QMenu *mTimeStampFieldMenu = nullptr;
QString mCurrentTimeStampField;

friend class TestQgsGpsIntegration;

};

#endif // QGSAPPGPSSETTINGSMANAGER_H
5 changes: 4 additions & 1 deletion src/app/options/qgsgpsoptions.h
Expand Up @@ -17,6 +17,7 @@

#include "ui_qgsgpsoptionswidgetbase.h"
#include "qgsoptionswidgetfactory.h"
#include "qgis_app.h"

/**
* \ingroup app
Expand All @@ -25,7 +26,7 @@
*
* \since QGIS 3.28
*/
class QgsGpsOptionsWidget : public QgsOptionsPageWidget, private Ui::QgsGpsOptionsWidgetBase
class APP_EXPORT QgsGpsOptionsWidget : public QgsOptionsPageWidget, private Ui::QgsGpsOptionsWidgetBase
{
Q_OBJECT

Expand All @@ -50,6 +51,8 @@ class QgsGpsOptionsWidget : public QgsOptionsPageWidget, private Ui::QgsGpsOptio
bool mBlockStoringChanges = false;
QIntValidator *mAcquisitionIntValidator = nullptr;
QIntValidator *mDistanceThresholdValidator = nullptr;

friend class TestQgsGpsIntegration;
};


Expand Down
2 changes: 1 addition & 1 deletion tests/src/app/CMakeLists.txt
Expand Up @@ -43,7 +43,7 @@ set(TESTS
testqgsprojectproperties.cpp
testqgsapplayoutvaliditychecks.cpp
testqgsmeshcalculatordialog.cpp
testqgsgpsinformationwidget.cpp
testqgsgpsintegration.cpp
testqgslabelpropertydialog.cpp
)

Expand Down

0 comments on commit 5aeac53

Please sign in to comment.