示例#1
0
    def test_read_write(self):

        c = Controller()

        filename = 'tests/files/test_all.aac'
        self.assertTrue(c.on_read_from_file(filename))

        filename = 'tmp/test_all.aac'
        self.assertTrue(c.on_write_to_file(filename))
示例#2
0
    def test_export_ascii(self):

        c = Controller()

        filename = 'tests/files/test_all.aac'
        self.assertTrue(c.on_read_from_file(filename))

        filename = 'tmp/test_all.txt'
        self.assertTrue(c.on_write_to_ascii_file(filename))
示例#3
0
    def test_export_pdf(self):

        c = Controller()

        filename = 'tests/files/test_all.aac'
        self.assertTrue(c.on_read_from_file(filename))

        # FIXME
        # To avoid using grid_view methods, use the controller to pass to grid_view.
        # With the disadvantage of not being able to check the outcome here.
        # Instead, visually check the existence and content of the PDF file.
        filename = 'tmp/test_all.pdf'
        c.on_export_as_pdf(filename)
示例#4
0
    def test_read_ascii(self):

        c = Controller()
        c.on_new()

        filename = 'tests/files/test_ascii.txt'
        self.assertTrue(c.on_load_ascii_from_file(filename))

        pos = Pos(0, 0)
        c.on_paste_objects(pos)

        filename = 'tmp/test_ascii.aac'
        self.assertTrue(c.on_write_to_file(filename))
示例#5
0
    def test_rect(self):

        c = Controller()
        c.on_new()

        start = Pos(5, 5)
        end = Pos(15, 15)

        c.on_paste_rect(start, end)

        filename = 'tmp/test_rect.aac'
        self.assertTrue(c.on_write_to_file(filename))
示例#6
0
    def test_import_aacircuit(self):

        c = Controller()
        c.legacy = True

        filename = 'tests/files/original_741.aac'
        self.assertTrue(c.on_read_from_file(filename))

        filename = 'tmp/741.aac'
        self.assertTrue(c.on_write_to_file(filename))

        # for (visual) verification only
        filename = 'tmp/741_legacy.pdf'
        c.on_export_as_pdf(filename)

        filename = 'tmp/741_legacy.txt'
        self.assertTrue(c.on_write_to_ascii_file(filename))
示例#7
0
    def test_lines(self):

        c = Controller()
        c.on_new()

        start = Pos(5, 5)
        end = Pos(15, 5)

        line_types = (Line.MLINE, Line.LINE1, Line.LINE2, Line.LINE3,
                      Line.LINE4)

        for type in line_types:
            c.on_paste_line(start, end, type)
            start += Pos(0, 5)
            end += Pos(0, 5)

        filename = 'tmp/test_lines.aac'
        self.assertTrue(c.on_write_to_file(filename))
示例#8
0
    def test_magic_line(self):

        c = Controller()
        c.on_new()

        # connect rectangle sides
        start = Pos(5, 5)
        end = Pos(15, 15)
        c.on_paste_rect(start, end)
        c.on_paste_mag_line(Pos(8, 5), Pos(15, 10))

        # connect component to line
        c.on_paste_line(Pos(5, 2), Pos(31, 2), 1)

        # NB test should be run against the default (en_US) component library
        c.on_component_changed('AND gate')
        c.on_paste_objects(Pos(25, 5))

        c.on_paste_mag_line(Pos(24, 6), Pos(15, 6))
        c.on_paste_mag_line(Pos(24, 8), Pos(20, 2))

        filename = 'tmp/test_magic_line.aac'
        self.assertTrue(c.on_write_to_file(filename))
示例#9
0
from infrastructure.repository1 import DepartmentsRepository, Departments
from infrastructure.repository2 import PatientRepository, Patients
from application.controller import Controller
from UI.console import UI
repo1 = DepartmentsRepository()
repo2 = PatientRepository()
ctrl = Controller(repo1, repo2)
patient1 = Patients("Jack", "Daniel", 1991115, "flu")
patient2 = Patients("Peter", "Sunny", 2657809, "ADHD")
patient3 = Patients("Angelina", "Mercy", 2090807, "flu")
patient4 = Patients("Joco", "Opra", 2578887, "Alzheimer")
patient5 = Patients("Alex", "Normand", 1009898, "flu")
patient6 = Patients("Thea", "Mico", 5890798, "ADHD")
repo2.add_patient(patient1)
repo2.add_patient(patient2)
repo2.add_patient(patient3)
repo2.add_patient(patient4)
repo2.add_patient(patient5)
repo2.add_patient(patient6)
department1 = Departments(1, "flu", 210)
department2 = Departments(2, "ADHD", 110)
department3 = Departments(3, "Alzheimer", 50)
department4 = Departments(4, "diabetes", 150)
repo1.add_department(department1)
repo1.add_department(department2)
repo1.add_department(department3)
repo1.add_department(department4)
ui = UI(ctrl)
ui.StartMenu()
示例#10
0
    def test_read_aac(self):

        c = Controller()

        filename = 'tests/files/test_tr_circuit.aac'
        self.assertTrue(c.on_read_from_file(filename))
示例#11
0
#!/usr/bin/env python
"""
AACircuit.py
2020-03-02 JvO

usage: python aacircuit.py
For debugging the Gtk (style) UI: export GTK_DEBUG=interactive; python aacircuit.py
"""

from application.controller import Controller

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk  # noqa: E402

if __name__ == "__main__":
    app = Controller()
    app.show_all()
    Gtk.main()
示例#12
0
    def test_erase(self):

        c = Controller()
        c.on_new()

        # NB test should be run against the default (en_US) component library
        c.on_component_changed('AND gate')
        c.on_paste_objects(Pos(4, 2))

        c.on_eraser_selected((5, 5))
        c.on_paste_objects(Pos(5, 2))

        filename = 'tmp/test_edit_erase.aac'
        self.assertTrue(c.on_write_to_file(filename))
示例#13
0
    def test_rows(self):

        c = Controller()
        c.on_new()
        grid = c.grid

        nr_rows_before = c.grid.nr_rows

        # private methods do change the grid dimensions
        grid._insert_row(3)
        self.assertEqual(grid.nr_rows, nr_rows_before + 1)

        grid._remove_row(3)
        self.assertEqual(grid.nr_rows, nr_rows_before)

        # the grid dimensions should stay the same
        c.on_grid_row(3, INSERT)
        self.assertEqual(grid.nr_rows, nr_rows_before)

        c.on_grid_row(3, REMOVE)
        self.assertEqual(grid.nr_rows, nr_rows_before)

        c.on_grid_row(3, REMOVE)
        c.on_grid_row(3, INSERT)
        self.assertEqual(grid.nr_rows, nr_rows_before)

        c.on_grid_row(3, REMOVE)
        c.on_undo()
        self.assertEqual(grid.nr_rows, nr_rows_before)
示例#14
0
    def test_duplicate(self):

        c = Controller()
        c.on_new()

        # NB test should be run against the default (en_US) component library
        c.on_component_changed('AND gate')
        c.on_paste_objects(Pos(4, 2))

        c.on_component_changed('NAND gate')
        c.on_paste_objects(Pos(4, 2))

        rect = (Pos(4, 2), Pos(5, 3))
        c.on_cut(rect)

        filename = 'tmp/test_edit_duplicate.aac'
        self.assertTrue(c.on_write_to_file(filename))