mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 23:35:57 +08:00
Add test for preferred material diameter mismatch
Done during Turbo Testing and Tooling.
This commit is contained in:
parent
93e397a0cc
commit
9b6443c2d3
@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2019 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import collections # For OrderedDict to ensure that the first iteration of preferred material is dependable.
|
||||
from unittest.mock import patch, MagicMock
|
||||
import pytest
|
||||
|
||||
@ -159,4 +160,11 @@ def test_preferredMaterialDiameter(empty_variant_node):
|
||||
"preferred_material_correct_diameter": MagicMock(getMetaDataEntry = lambda x: 3) # Correct approximate diameter.
|
||||
}
|
||||
|
||||
assert empty_variant_node.preferredMaterial(approximate_diameter = 3) == empty_variant_node.materials["preferred_material_correct_diameter"], "It should match only on the material with correct diameter."
|
||||
assert empty_variant_node.preferredMaterial(approximate_diameter = 3) == empty_variant_node.materials["preferred_material_correct_diameter"], "It should match only on the material with correct diameter."
|
||||
|
||||
def test_preferredMaterialDiameterNoMatch(empty_variant_node):
|
||||
empty_variant_node.materials = collections.OrderedDict()
|
||||
empty_variant_node.materials["some_different_material"] = MagicMock(getMetaDataEntry = lambda x: 3) # This one first so that it gets iterated over first.
|
||||
empty_variant_node.materials["preferred_material_wrong_diameter"] = MagicMock(getMetaDataEntry = lambda x: 2)
|
||||
|
||||
assert empty_variant_node.preferredMaterial(approximate_diameter = 3) == empty_variant_node.materials["some_different_material"], "It should match on another material with the correct diameter if the preferred one is unavailable."
|
Loading…
x
Reference in New Issue
Block a user