snu-quiqcl / qiwis

QuIqcl Widget Integration Software
MIT License
5 stars 2 forks source link

Test swift.swift #122

Closed BECATRUE closed 1 year ago

BECATRUE commented 1 year ago

This PR will close #107.

I implemented all tests in swift.swift.

During tests, I found a minor bug in Swift class. In createApp(), we added QDockWidgets to self.mainWindow as below:

area = {
    "left": Qt.LeftDockWidgetArea,
    "right": Qt.RightDockWidgetArea,
    "top": Qt.TopDockWidgetArea,
    "bottom": Qt.BottomDockWidgetArea
}.get(info.pos, Qt.AllDockWidgetAreas)
self.mainWindow.addDockWidget(area, dockWidget)

However, if area arguments is Qt.AllDockWidgetAreas, the warning occurs like below:

QMainWindow::addDockWidget: invalid 'area' argument

Thus, as a solution, I changed it into Qt.LeftDockWidgetArea.

If you think it should be separated into new issue, I will do so.

BECATRUE commented 1 year ago

The testing result is like below:

image

It is also shown in GitHub Action details.

kangz12345 commented 1 year ago

In addition, why isn't there a test for createApp()?

BECATRUE commented 1 year ago

In addition, why isn't there a test for createApp()?

I doesn't test it because it is called automatically by the constructor. And also, I tested with two diffrent app infos, so all functions in createApp() were checked.

BECATRUE commented 1 year ago

First of all, I updated it up to where I modified it.

BECATRUE commented 1 year ago

I applied all reviews.

In test_broadcast(), I called _broadcast() with all buses and checked if each app is called by the number of buses it subcribes to. In test_destroy_app(), I destroyed all apps and checked if self.swift._apps is empty.

BECATRUE commented 1 year ago

I updated it! @kangz12345