Skip to content

Commit dbbf062

Browse files
committedDec 20, 2016
Fix bindings and tests
1 parent 95fedd0 commit dbbf062

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed
 

‎python/core/qgsmapthemecollection.sip

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,13 @@ class QgsMapThemeCollection : QObject
150150
* @note added in QGIS 3.0
151151
*/
152152
void applyTheme( const QString& name, QgsLayerTreeGroup* root, QgsLayerTreeModel* model );
153-
153+
QgsProject* project();
154+
void setProject( QgsProject* project );
154155
signals:
155156

156157
/** Emitted when map themes within the collection are changed.
157158
*/
158159
void mapThemesChanged();
160+
void projectChanged();
159161
};
160162

‎python/core/qgsprojectversion.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class QgsProjectVersion
2020
int minorVersion();
2121
int subVersion();
2222
QString text();
23+
bool isNull() const;
2324

2425
/** Boolean equal operator
2526
*/

‎python/core/qgssnappingconfig.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,6 @@ class QgsSnappingConfig
222222
*/
223223
bool removeLayers( const QList<QgsMapLayer*>& layers );
224224
QgsProject* project() const;
225-
void setProject(QgsProject* project);
225+
void setProject( QgsProject* project );
226226

227227
};

‎src/core/qgssnappingconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class CORE_EXPORT QgsSnappingConfig
227227
QgsProject* project() const;
228228

229229
/**
230-
* \copydoc project()
230+
* The project from which the snapped layers should be retrieved
231231
*
232232
* \note Added in QGIS 3.0
233233
*/

‎tests/src/python/test_qgsattributetablemodel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def setUp(self):
4242
self.cache = QgsVectorLayerCache(self.layer, 100)
4343
self.am = QgsAttributeTableModel(self.cache)
4444
self.am.loadLayer()
45-
self.am.loadAttributes()
4645

4746
def tearDown(self):
4847
del self.am

‎tests/src/python/test_qgsfieldformatters.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import qgis # NOQA
1616

17-
from qgis.core import (QgsMapLayerRegistry, QgsFeature, QgsGeometry, QgsPoint,
17+
from qgis.core import (QgsFeature, QgsGeometry, QgsPoint,
1818
QgsProject, QgsRelation, QgsVectorLayer, NULL, QgsField,
1919
QgsValueMapFieldFormatter, QgsValueRelationFieldFormatter,
2020
QgsRelationReferenceFieldFormatter)
@@ -34,7 +34,7 @@ def test_representValue(self):
3434
layer = QgsVectorLayer("none?field=number1:integer&field=number2:double&field=text1:string&field=number3:integer&field=number4:double&field=text2:string",
3535
"layer", "memory")
3636
self.assertTrue(layer.isValid())
37-
QgsMapLayerRegistry.instance().addMapLayer(layer)
37+
QgsProject.instance().addMapLayer(layer)
3838
f = QgsFeature()
3939
f.setAttributes([2, 2.5, 'NULL', None, None, None])
4040
layer.dataProvider().addFeatures([f])
@@ -60,7 +60,7 @@ def test_representValue(self):
6060
self.assertEqual(fieldFormatter.representValue(layer, 4, config, None, None), '(NULL)')
6161
self.assertEqual(fieldFormatter.representValue(layer, 5, config, None, None), '(NULL)')
6262

63-
QgsMapLayerRegistry.instance().removeAllMapLayers()
63+
QgsProject.instance().removeAllMapLayers()
6464

6565

6666
class TestQgsValueRelationFieldFormatter(unittest.TestCase):
@@ -73,7 +73,7 @@ def test_representValue(self):
7373
second_layer = QgsVectorLayer("none?field=pkid:integer&field=decoded:string",
7474
"second_layer", "memory")
7575
self.assertTrue(second_layer.isValid())
76-
QgsMapLayerRegistry.instance().addMapLayer(second_layer)
76+
QgsProject.instance().addMapLayer(second_layer)
7777
f = QgsFeature()
7878
f.setAttributes([123])
7979
first_layer.dataProvider().addFeatures([f])
@@ -107,7 +107,7 @@ def test_representValue(self):
107107
config = {'Layer': second_layer.id(), 'Key': 'pkid', 'Value': 'invalid'}
108108
self.assertEqual(fieldFormatter.representValue(first_layer, 0, config, None, '456'), '(456)')
109109

110-
QgsMapLayerRegistry.instance().removeMapLayer(second_layer.id())
110+
QgsProject.instance().removeMapLayer(second_layer.id())
111111

112112

113113
class TestQgsRelationReferenceFieldFormatter(unittest.TestCase):
@@ -120,7 +120,7 @@ def test_representValue(self):
120120
second_layer = QgsVectorLayer("none?field=pkid:integer&field=decoded:string",
121121
"second_layer", "memory")
122122
self.assertTrue(second_layer.isValid())
123-
QgsMapLayerRegistry.instance().addMapLayers([first_layer, second_layer])
123+
QgsProject.instance().addMapLayers([first_layer, second_layer])
124124
f = QgsFeature()
125125
f.setAttributes([123])
126126
first_layer.dataProvider().addFeatures([f])
@@ -196,7 +196,7 @@ def test_representValue(self):
196196
second_layer.setDisplayExpression('decoded')
197197
self.assertEqual(fieldFormatter.representValue(first_layer, 0, config, None, '123'), '123')
198198

199-
QgsMapLayerRegistry.instance().removeAllMapLayers()
199+
QgsProject.instance().removeAllMapLayers()
200200

201201
if __name__ == '__main__':
202202
unittest.main()

‎tests/testdata/provider/testdata_pg.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ CREATE TABLE qgis_test.widget_styles(
457457
);
458458

459459
INSERT INTO qgis_editor_widget_styles VALUES
460-
('qgis_test', 'widget_styles', 'fld1', 'FooEdit', '<config type="Map"><Option name="param1" value="value1" type="String"/><Option name="param2" value="2" type="String"/></config>');
460+
('qgis_test', 'widget_styles', 'fld1', 'FooEdit', '<config type="Map"><Option name="param1" value="value1" type="QString"/><Option name="param2" value="2" type="QString"/></config>');
461461

462462

463463
-----------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.