11#include < QtTest/QSignalSpy>
2- #include < scratchcpp/virtualmachine.h>
32#include < scratchcpp/list.h>
43#include < listmonitormodel.h>
54#include < listmonitorlistmodel.h>
@@ -29,7 +28,6 @@ TEST(ListMonitorModelTest, OnValueChanged)
2928 ListMonitorModel model;
3029 ListMonitorListModel *listModel = model.listModel ();
3130 QSignalSpy dataChangedSpy (listModel, &ListMonitorListModel::dataChanged);
32- VirtualMachine vm;
3331
3432 List list1 (" " , " " );
3533 list1.append (1 );
@@ -46,38 +44,26 @@ TEST(ListMonitorModelTest, OnValueChanged)
4644 list3.append (2 );
4745 list3.append (3 );
4846
49- List *lists[] = { &list1, &list2, &list3 };
50- vm.setLists (lists);
51-
52- vm.addReturnValue (1 );
53- model.onValueChanged (&vm);
47+ model.onValueChanged (&list2);
5448 ASSERT_EQ (listModel->rowCount (QModelIndex ()), 4 );
5549
56- vm.reset ();
57- vm.addReturnValue (2 );
58- model.onValueChanged (&vm);
50+ model.onValueChanged (&list3);
5951 ASSERT_EQ (listModel->rowCount (QModelIndex ()), 3 );
6052
61- vm.reset ();
62- vm.addReturnValue (2 );
6353 model.setMinIndex (0 );
6454 model.setMaxIndex (3 );
65- model.onValueChanged (&vm );
55+ model.onValueChanged (&list3 );
6656 ASSERT_EQ (listModel->rowCount (QModelIndex ()), 3 );
6757 ASSERT_EQ (dataChangedSpy.count (), 4 );
6858
6959 dataChangedSpy.clear ();
70- vm.reset ();
71- vm.addReturnValue (2 );
7260 model.setMinIndex (1 );
7361 model.setMaxIndex (2 );
74- model.onValueChanged (&vm );
62+ model.onValueChanged (&list3 );
7563 ASSERT_EQ (listModel->rowCount (QModelIndex ()), 3 );
7664 ASSERT_EQ (dataChangedSpy.count (), 2 );
7765
78- vm.reset ();
79- vm.addReturnValue (0 );
80- model.onValueChanged (&vm);
66+ model.onValueChanged (&list1);
8167 ASSERT_EQ (listModel->rowCount (QModelIndex ()), 2 );
8268}
8369
0 commit comments