diff --git a/b_asic/gui_utils/plot_window.py b/b_asic/gui_utils/plot_window.py
index 77babe1f7e732386b199581507e1ee88c50b5645..7aec9c3525634b3893548eac27e23fd8c8461b04 100644
--- a/b_asic/gui_utils/plot_window.py
+++ b/b_asic/gui_utils/plot_window.py
@@ -100,8 +100,14 @@ class PlotWindow(QDialog):
         self._plot_axes = self._plot_fig.add_subplot(111)
         self._plot_axes.xaxis.set_major_locator(MaxNLocator(integer=True))
 
+        # Use | when dropping support for Python 3.8
+        ordered_for_plotting = {}
+        ordered_for_plotting.update(sim_res_others)
+        ordered_for_plotting.update(sim_res_delays)
+        ordered_for_plotting.update(sim_res_ins)
+        ordered_for_plotting.update(sim_res_outs)
         self._lines = {}
-        for key in sim_res_others | sim_res_delays | sim_res_ins | sim_res_outs:
+        for key, result in ordered_for_plotting.items():
             line = self._plot_axes.plot(sim_result[key], label=key)
             self._lines[key] = line[0]
 
@@ -114,12 +120,12 @@ class PlotWindow(QDialog):
 
         # Add two buttons for selecting all/none:
         hlayout = QHBoxLayout()
-        button_all = QPushButton("&All")
-        button_all.clicked.connect(self._button_all_click)
-        hlayout.addWidget(button_all)
-        button_none = QPushButton("&None")
-        button_none.clicked.connect(self._button_none_click)
-        hlayout.addWidget(button_none)
+        self._button_all = QPushButton("&All")
+        self._button_all.clicked.connect(self._button_all_click)
+        hlayout.addWidget(self._button_all)
+        self._button_none = QPushButton("&None")
+        self._button_none.clicked.connect(self._button_none_click)
+        hlayout.addWidget(self._button_none)
         listlayout.addLayout(hlayout)
 
         # Add the entire list
@@ -127,7 +133,13 @@ class PlotWindow(QDialog):
         self.checklist.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
         self.checklist.itemChanged.connect(self._item_change)
         listitems = {}
-        for key in sim_res_ins | sim_res_outs | sim_res_delays | sim_res_others:
+        # Use | when dropping support for Python 3.8
+        ordered_for_checklist = {}
+        ordered_for_checklist.update(sim_res_ins)
+        ordered_for_checklist.update(sim_res_outs)
+        ordered_for_checklist.update(sim_res_delays)
+        ordered_for_checklist.update(sim_res_others)
+        for key in ordered_for_checklist:
             listitem = QListWidgetItem(key)
             listitems[key] = listitem
             self.checklist.addItem(listitem)
diff --git a/test/test_simulation_gui.py b/test/test_simulation_gui.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b2690639723fa386b0c8d4e99fcf68d96a627d4
--- /dev/null
+++ b/test/test_simulation_gui.py
@@ -0,0 +1,50 @@
+import pytest
+from qtpy import QtCore
+
+try:
+    from b_asic.gui_utils.plot_window import PlotWindow
+except ImportError:
+    pytestmark = pytest.mark.skip("Qt not setup")
+
+
+def test_start(qtbot):
+    widget = PlotWindow({})
+    qtbot.addWidget(widget)
+
+
+def test_start_with_data(qtbot):
+    sim_res = {
+        '0': [0.5, 0.5, 0, 0],
+        'add1': [0.5, 0.5, 0, 0],
+        'cmul1': [0, 0.5, 0, 0],
+        'cmul2': [0.5, 0, 0, 0],
+        'in1': [1, 0, 0, 0],
+        't1': [0, 1, 0, 0],
+    }
+    widget = PlotWindow(sim_res)
+    qtbot.addWidget(widget)
+
+    assert widget.checklist.count() == 6
+    assert len(widget._plot_axes.lines) == 1
+
+
+def test_click_buttons(qtbot):
+    sim_res = {
+        '0': [0.5, 0.5, 0, 0],
+        'add1': [0.5, 0.5, 0, 0],
+        'cmul1': [0, 0.5, 0, 0],
+        'cmul2': [0.5, 0, 0, 0],
+        'in1': [1, 0, 0, 0],
+        't1': [0, 1, 0, 0],
+    }
+    widget = PlotWindow(sim_res)
+    qtbot.addWidget(widget)
+
+    assert widget.checklist.count() == 6
+    assert len(widget._plot_axes.lines) == 1
+
+    qtbot.mouseClick(widget._button_all, QtCore.Qt.MouseButton.LeftButton)
+    assert len(widget._plot_axes.lines) == 6
+
+    qtbot.mouseClick(widget._button_none, QtCore.Qt.MouseButton.LeftButton)
+    assert len(widget._plot_axes.lines) == 0