    def test_list_box_scrollbar(self):
        """
        Check ListBox scrollbar works.
        """
        # Create a dummy screen.
        screen = MagicMock(spec=Screen, colours=8, unicode_aware=False)
        scene = Scene([], -1)
        canvas = Canvas(screen, 10, 40, 0, 0)

        # Create the form we want to test.
        form = Frame(canvas, canvas.height, canvas.width, has_border=False, can_scroll=False)
        layout = Layout([100], fill_frame=True)
        simple_list = ListBox(
            3,
            [
                ("Some", 1),
                ("Stuff", 2),
                ("To", 3),
                ("See", 4),
            ],
            add_scroll_bar=True,
            name="simple_list")
        form.add_layout(layout)
        layout.add_widget(simple_list)
        form.fix()
        scene.add_effect(form)
        form.reset()

        # Check that the widget is rendered correctly with the scrollbar
        form.update(0)
        self.assert_canvas_equals(
            canvas,
            "Some                                   O\n" +
            "Stuff                                  |\n" +
            "To                                     |\n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n")

        # Check that mouse input works
        self.process_mouse(form, [(39, 2, MouseEvent.LEFT_CLICK)])
        form.update(0)
        self.assert_canvas_equals(
            canvas,
            "Stuff                                  |\n" +
            "To                                     |\n" +
            "See                                    O\n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n")

        # Check that options can be set and hide scrollbar
        simple_list.options = [("New list", 1)]
        form.update(0)
        self.assert_canvas_equals(
            canvas,
            "New list                                \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n" +
            "                                        \n")
Check ListBox scrollbar works.
tests/test_widgets.py