def testGettersSetters(self): """ test model getters/setters """ l = create_layer() m = QgsFieldModel() self.assertFalse(m.layer()) m.setLayer(l) self.assertEqual(m.layer(), l) m.setAllowExpression(True) self.assertTrue(m.allowExpression()) m.setAllowExpression(False) self.assertFalse(m.allowExpression()) m.setAllowEmptyFieldName(True) self.assertTrue(m.allowEmptyFieldName()) m.setAllowEmptyFieldName(False) self.assertFalse(m.allowEmptyFieldName())
def create_model(): l = create_layer() m = QgsFieldModel() m.setLayer(l) return l, m