Skip to content

Commit fc49f8d

Browse files
committed
Add test for coverage of SIP bindings
Not perfect, but good for a quick warning if a new class or member has been added to the public API without Python bindings. The test only considers the name of members, since it seems to be impossible to test for the signature of a Python member. (So adding a new overloaded method without bindings will still unfortunately pass). You can avoid the test where bindings are not applicable: - for a whole class by placing "@note not available in Python bindings" in the class' Doxygen comments - or by placing the @note inside a member's Doxygen comments for a specific member Additionally, classes which aren't included in the API docs will not be tested.
1 parent 7842391 commit fc49f8d

18 files changed

+493
-174
lines changed

python/core/effects/qgspainteffectregistry.sip

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ class QgsPaintEffectRegistry
6969

7070
public:
7171

72+
/** Returns a reference to the singleton instance of the paint effect registry.
73+
*/
74+
static QgsPaintEffectRegistry* instance();
75+
7276
/** Returns the metadata for a specific effect.
7377
* @param name unique string name for paint effect class
7478
* @returns paint effect metadata if found, otherwise NULL

python/gui/qgsfieldcombobox.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@ class QgsFieldComboBox : QComboBox
4444

4545
//! setField sets the currently selected field
4646
void setField( const QString& fieldName );
47+
48+
protected slots:
49+
void indexChanged( int i );
4750
};

src/core/effects/qgspainteffectregistry.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata
154154
class CORE_EXPORT QgsPaintEffectRegistry
155155
{
156156
public:
157+
158+
/** Returns a reference to the singleton instance of the paint effect registry.
159+
*/
157160
static QgsPaintEffectRegistry* instance();
158161

159162
/** Returns the metadata for a specific effect.

src/core/geometry/qgsgeos.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ class GEOSInit
9898

9999
static GEOSInit geosinit;
100100

101+
/**
102+
* @brief Scoped GEOS pointer
103+
* @note not available in Python bindings
104+
*/
101105
class GEOSGeomScopedPtr
102106
{
103107
public:

src/core/pal/costcalculator.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#include <QList>
1919
#include "rtree.hpp"
2020

21+
/**
22+
* \class pal::CostCalculator
23+
* \note not available in Python bindings
24+
*/
25+
2126
namespace pal
2227
{
2328
class Feats;
@@ -48,9 +53,11 @@ namespace pal
4853
/**
4954
* \brief Data structure to compute polygon's candidates costs
5055
*
51-
* eight segment from center of candidat to (rpx,rpy) points (0°, 45°, 90°, ..., 315°)
56+
* Eight segments from center of candidate to (rpx,rpy) points (0°, 45°, 90°, ..., 315°)
5257
* dist store the shortest square distance from the center to an object
5358
* ok[i] is the to true whether the corresponding dist[i] is set
59+
*
60+
* \note not available in Python bindings
5461
*/
5562
class PolygonCostCalculator
5663
{

src/core/pal/feature.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141

4242
#include "qgslabelingenginev2.h"
4343

44+
/**
45+
* \class pal::LabelInfo
46+
* \note not available in Python bindings
47+
*/
48+
4449
namespace pal
4550
{
4651
/** Optional additional info about label (for curved labels) */
@@ -75,6 +80,8 @@ namespace pal
7580

7681
/**
7782
* \brief Main class to handle feature
83+
* \class pal::FeaturePart
84+
* \note not available in Python bindings
7885
*/
7986
class CORE_EXPORT FeaturePart : public PointSet
8087
{

src/core/pal/labelposition.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ namespace pal
4444

4545
/**
4646
* \brief LabelPosition is a candidate feature label position
47+
* \class pal::LabelPosition
48+
* \note not available in Python bindings
4749
*/
4850
class CORE_EXPORT LabelPosition : public PointSet
4951
{

src/core/pal/layer.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ namespace pal
4848
class LabelInfo;
4949

5050
/**
51-
* \brief A layer of spacial entites
52-
*
53-
* a layer is a bog of feature with some data which influence the labelling process
54-
*
55-
* \author Maxence Laurent (maxence _dot_ laurent _at_ heig-vd _dot_ ch)
51+
* \brief A set of features which influence the labelling process
52+
* \class pal::Layer
53+
* \note not available in Python bindings
5654
*/
5755
class CORE_EXPORT Layer
5856
{

src/core/pal/pal.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@
4141

4242
class QgsAbstractLabelProvider;
4343

44-
/**
45-
*
46-
* \section intro_sec Introduction
47-
*
48-
* Pal is a labelling library released under the GPLv3 license
49-
*
50-
*/
51-
5244
namespace pal
5345
{
5446
/** Get GEOS context handle to be used in all GEOS library calls with reentrant API */
@@ -101,12 +93,12 @@ namespace pal
10193
};
10294

10395
/**
104-
* \brief Pal main class.
96+
* \brief Main Pal labelling class
10597
*
10698
* A pal object will contains layers and global information such as which search method
10799
* will be used.
108-
*
109-
* \author Maxence Laurent (maxence _dot_ laurent _at_ heig-vd _dot_ ch)
100+
* \class pal::Pal
101+
* \note not available in Python bindings
110102
*/
111103
class CORE_EXPORT Pal
112104
{

src/core/pal/palstat.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ namespace pal
3636
{
3737

3838
/**
39-
* Summury of problem
39+
* \brief Summary statistics of labelling problem.
40+
* \class pal::PalStat
41+
* \note not available in Python bindings
4042
*/
43+
4144
class PalStat
4245
{
4346

src/core/pal/pointset.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ namespace pal
5656
double length;
5757
} CHullBox;
5858

59-
59+
/**
60+
* \class pal::PointSet
61+
* \note not available in Python bindings
62+
*/
6063
class CORE_EXPORT PointSet
6164
{
6265
friend class FeaturePart;

src/core/pal/priorityqueue.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@
3939

4040
namespace pal
4141
{
42-
42+
/**
43+
* \class pal::PriorityQueue
44+
* \note not available in Python bindings
45+
*/
4346
class PriorityQueue
4447
{
4548

src/core/pal/problem.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ namespace pal
4141
class LabelPosition;
4242
class Label;
4343

44+
/**
45+
* \class pal::Sol
46+
* \note not available in Python bindings
47+
*/
4448
class Sol
4549
{
4650
public:
@@ -88,7 +92,9 @@ namespace pal
8892
} Chain;
8993

9094
/**
91-
* \brief Represent a problem
95+
* \brief Representation of a labeling problem
96+
* \class pal::Problem
97+
* \note not available in Python bindings
9298
*/
9399
class CORE_EXPORT Problem
94100
{

src/core/pal/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ namespace pal
4646

4747
/**
4848
* \brief For usage in problem solving algorithm
49+
* \note not available in Python bindings
4950
*/
5051
class Feats
5152
{

tests/src/python/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ ENDIF (ENABLE_PGTEST)
7979

8080
IF (WITH_APIDOC)
8181
ADD_PYTHON_TEST(PyQgsDocCoverage test_qgsdoccoverage.py)
82+
#SIP coverage test relies on API doc parsing to identify members which should be in bindings
83+
ADD_PYTHON_TEST(PyQgsSipCoverage test_qgssipcoverage.py)
8284
ENDIF (WITH_APIDOC)
8385

8486
IF (WITH_SERVER)

0 commit comments

Comments
 (0)