Beispiel #1
0
def test_basic(
        first_polygons_pair: Tuple[BoundPolygon, PortedPolygon],
        second_polygons_pair: Tuple[BoundPolygon, PortedPolygon]) -> None:
    first_bound, first_ported = first_polygons_pair
    second_bound, second_ported = second_polygons_pair

    assert are_bound_ported_polygons_equal(first_bound, first_ported)

    first_bound.join(second_bound)
    first_ported.join(second_ported)

    assert are_bound_ported_polygons_equal(first_bound, first_ported)
    assert are_bound_ported_polygons_equal(second_bound, second_ported)
Beispiel #2
0
def test_basic(
        operations_pair: Tuple[BoundOperation, PortedOperation]) -> None:
    bound, ported = operations_pair

    bound.run()
    ported.run()

    assert are_bound_ported_polygons_equal(bound.resultant, ported.resultant)
Beispiel #3
0
def test_basic(
    contours_lists_pair: Tuple[List[BoundContour],
                               List[PortedContour]]) -> None:
    bound_contours, ported_contours = contours_lists_pair

    bound, ported = (BoundPolygon(bound_contours),
                     PortedPolygon(ported_contours))

    assert are_bound_ported_polygons_equal(bound, ported)
Beispiel #4
0
def test_basic(
    polygons_pairs_pair: Tuple[Tuple[BoundPolygon, PortedPolygon],
                               Tuple[BoundPolygon, PortedPolygon]],
    operations_types_pair: Tuple[BoundOperationType,
                                 PortedOperationType]) -> None:
    ((bound_left, ported_left), (bound_right,
                                 ported_right)) = polygons_pairs_pair
    bound_operation_type, ported_operation_type = operations_types_pair

    bound_result = bound(bound_left, bound_right, bound_operation_type)
    ported_result = ported(ported_left, ported_right, ported_operation_type)

    assert are_bound_ported_polygons_equal(bound_result, ported_result)
Beispiel #5
0
def test_basic(
    operations_with_events_lists_pair: Tuple[Tuple[BoundOperation,
                                                   PortedOperation],
                                             Tuple[List[BoundSweepEvent],
                                                   List[PortedSweepEvent]]]
) -> None:
    ((bound, ported), (bound_events,
                       ported_events)) = operations_with_events_lists_pair

    bound.connect_edges(bound_events)
    ported.connect_edges(ported_events)

    assert are_bound_ported_sweep_events_lists_equal(bound_events,
                                                     ported_events)
    assert are_bound_ported_polygons_equal(bound.resultant, ported.resultant)
Beispiel #6
0
def test_round_trip(polygons_pair: Tuple[BoundPolygon, PortedPolygon]) -> None:
    bound, ported = polygons_pair

    assert are_bound_ported_polygons_equal(pickle_round_trip(bound),
                                           pickle_round_trip(ported))
Beispiel #7
0
def test_deep(polygons_pair: Tuple[BoundPolygon, PortedPolygon]) -> None:
    bound, ported = polygons_pair

    assert are_bound_ported_polygons_equal(copy.deepcopy(bound),
                                           copy.deepcopy(ported))
Beispiel #8
0
def test_basic(
        operations_pair: Tuple[BoundOperation, PortedOperation]) -> None:
    bound, ported = operations_pair

    assert bound.is_trivial is ported.is_trivial
    assert are_bound_ported_polygons_equal(bound.resultant, ported.resultant)