mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-10 07:09:02 +08:00
Test fixes, not working yet
This commit is contained in:
parent
73b423138a
commit
882352c99d
@ -25,7 +25,7 @@ class ExtruderConfigurationModel(QObject):
|
||||
return self._position
|
||||
|
||||
def setMaterial(self, material: Optional[MaterialOutputModel]) -> None:
|
||||
if self._hotend_id != material:
|
||||
if self._material != material:
|
||||
self._material = material
|
||||
self.extruderConfigurationChanged.emit()
|
||||
|
||||
@ -33,7 +33,7 @@ class ExtruderConfigurationModel(QObject):
|
||||
def activeMaterial(self) -> Optional[MaterialOutputModel]:
|
||||
return self._material
|
||||
|
||||
@pyqtProperty(QObject, fset=setMaterial, notify=extruderConfigurationChanged)
|
||||
@pyqtProperty(QObject, fset = setMaterial, notify = extruderConfigurationChanged)
|
||||
def material(self) -> Optional[MaterialOutputModel]:
|
||||
return self._material
|
||||
|
||||
|
@ -63,6 +63,12 @@ def test_uniqueConfigurations(printer_output_device):
|
||||
# Once the type of printer is set, it's active configuration counts as being set.
|
||||
# In that case, that should also be added to the list of available configurations
|
||||
printer.updateType("blarg!")
|
||||
loaded_material = MaterialOutputModel(guid = "", type = "PLA", color = "Blue", brand = "Generic", name = "Blue PLA")
|
||||
loaded_left_extruder = ExtruderConfigurationModel(0)
|
||||
loaded_left_extruder.setMaterial(loaded_material)
|
||||
loaded_right_extruder = ExtruderConfigurationModel(1)
|
||||
loaded_right_extruder.setMaterial(loaded_material)
|
||||
printer.printerConfiguration.setExtruderConfigurations([loaded_left_extruder, loaded_right_extruder])
|
||||
assert printer_output_device.uniqueConfigurations == [configuration, printer.printerConfiguration]
|
||||
|
||||
|
||||
@ -72,10 +78,11 @@ def test_uniqueConfigurations_empty_is_filtered_out(printer_output_device):
|
||||
printer_output_device._printers = [printer]
|
||||
printer_output_device._onPrintersChanged()
|
||||
|
||||
printer.updateType("blarg!")
|
||||
empty_material = MaterialOutputModel(guid = "", type = "empty", color = "empty", brand = "Generic", name = "Empty")
|
||||
empty_left_extruder = ExtruderConfigurationModel(0)
|
||||
empty_left_extruder.setMaterial(empty_material)
|
||||
empty_right_extruder = ExtruderConfigurationModel(1)
|
||||
empty_right_extruder.setMaterial(empty_material)
|
||||
printer.printerConfiguration.setExtruderConfigurations([empty_left_extruder, empty_right_extruder])
|
||||
assert printer_output_device.uniqueConfiguration == []
|
||||
assert printer_output_device.uniqueConfigurations == []
|
||||
|
Loading…
x
Reference in New Issue
Block a user