def test_drop_to(self):
     sys = UnitSystem()
     location = (0, 0)
     ops = sys.create_output_paper_stack(location)
     sheet = Sheet()
     sheet.plots[Color.Red] = 42
     sys.drop_to_unit_at(sheet, location, (0, 1))
     self.assertIn(sheet, ops.received_sheets)
Exemplo n.º 2
0
def create_functional_units_and_actors(sys: UnitSystem) -> List[FunctionalUnit]:
    return [
        InputActor.start(sys.create_input_paper_stack((0, 1))),
        OutputActor.start(sys.create_output_paper_stack((3, 1))),
        ConveyorActor.start(sys.create_conveyor((1, 1))),
        ConveyorActor.start(sys.create_conveyor((2, 1))),
        PlotterActor.start(sys.create_plotter((1, 0), color=Color.Red)),
        PlotterActor.start(sys.create_plotter((2, 0), color=Color.Green)),
        PlotterActor.start(sys.create_plotter((1, 2), color=Color.Yellow)),
        PlotterActor.start(sys.create_plotter((2, 2), color=Color.Blue))]
 def test_setup_1(self):  # check nothing crashes
     sys = UnitSystem()
     supervisor = SupervisorActor.start()
     InputActor.start(sys.create_input_paper_stack((0, 1))),
     OutputActor.start(sys.create_output_paper_stack((3, 1))),
     ConveyorActor.start(sys.create_conveyor((1, 1))),
     ConveyorActor.start(sys.create_conveyor((2, 1))),
     PlotterActor.start(sys.create_plotter((1, 0), color=Color.Red)),
     PlotterActor.start(sys.create_plotter((2, 0), color=Color.Green)),
     PlotterActor.start(sys.create_plotter((1, 3), color=Color.Yellow)),
     PlotterActor.start(sys.create_plotter((2, 3), color=Color.Blue))
     time.sleep(10)
     ActorRegistry().stop_all(block=True)
 def test_unit_creation(self):
     sys = UnitSystem()
     ips = sys.create_input_paper_stack((0, 0))
     self.assertIsNotNone(ips)
     self.assertEqual(sys, ips.unit_sytem)
     ops = sys.create_output_paper_stack((0, 0))
     self.assertIsNotNone(ops)
     self.assertEqual(sys, ops.unit_sytem)
     plt = sys.create_plotter((0, 0), Color.Red)
     self.assertIsNotNone(plt)
     self.assertEqual(sys, plt.unit_sytem)
     con = sys.create_conveyor((0, 0))
     self.assertIsNotNone(con)
 def test_setup_2(self):  # smaller setup
     sys = UnitSystem()
     supervisor = SupervisorActor.start()
     InputActor.start(sys.create_input_paper_stack((0, 1))),
     ops = sys.create_output_paper_stack((2, 1))
     OutputActor.start(ops),
     ConveyorActor.start(sys.create_conveyor((1, 1))),
     PlotterActor.start(sys.create_plotter((1, 0), color=Color.Red)),
     PlotterActor.start(sys.create_plotter((1, 2), color=Color.Blue)),
     sheet_orders = [SheetOrder({Color.Red: 1})]
     for order in sheet_orders:
         supervisor.tell(SheetOrderMessage(order))
     SleepyActor.start(20).stop(True)
     for order in sheet_orders:
         self.assertIn(order, ops.received_sheets)
     ActorRegistry().stop_all(block=True)