def test_exclusiveLayerSelection(qApp): document = Document() layerModel = LayerModel() layerModel.document = document layer1 = Layer(name='Layer 1', active=True) layer2 = Layer(name='Layer 2') document.addItems(layer1, layer2) assert layer1.active() == True layerModel.setActiveExclusively(1) assert layer2.active() == True assert layer1.active() == False
def test_reset_layered_props(qApp): """ Item.write was not explicitly requesting non-layered prop values. """ document = Document() person = Person() layer = Layer(name='Layer 1', active=True, storeGeometry=True) document.addItems(person, layer) person.setItemPos(QPointF(10, 10)) assert layer.active() == True assert person.pos() == QPointF(10, 10) document.resetAll() # was throwing exception in commands.py assert person.itemPos() == QPointF() assert person.pos() == QPointF()
def test_set_active(qApp): model = LayerModel() document = Document() layer1 = Layer(name='Layer 1') layer2 = Layer(name='Layer 2') layer3 = Layer(name='Layer 3') document.addItems(layer1, layer2, layer3) model.document = document assert layer1.active() == False assert layer2.active() == False assert layer3.active() == False def set(row, value): assert model.setData(model.index(row, 0), value, model.ActiveRole) is True set(0, True) assert layer1.active() == True assert layer2.active() == False assert layer2.active() == False set(2, True) assert layer1.active() == True assert layer2.active() == False assert layer3.active() == True set(0, False) assert layer1.active() == False assert layer2.active() == False assert layer3.active() == True set(2, False) assert layer1.active() == False assert layer2.active() == False assert layer3.active() == False