def test_backgroundColorSerialize(self): """Test backgroundColor serialization""" layer = self.createLayer() config = layer.editFormConfig() color_name = '#ff00ff' container = QgsAttributeEditorContainer('container name', None, QColor('#ff00ff')) doc = QDomDocument() element = container.toDomElement(doc) config = QgsEditFormConfig() container2 = config.attributeEditorElementFromDomElement(element, None, self.layer.id()) self.assertEqual(container2.backgroundColor().name(), color_name)