@@ -106,6 +106,37 @@ void NoteColumnModelTest::test_setLineFocused_shouldUpdateData()
106106 QCOMPARE (model.data (idx, static_cast <int >(NoteColumnModel::DataRole::LineColumn)).toInt (), 1 );
107107}
108108
109+ void NoteColumnModelTest::test_updateIndexHighlights_shouldEmitDataChangedWithCorrectRange ()
110+ {
111+ const auto automationService { std::make_shared<AutomationService>() };
112+ const auto selectionService { std::make_shared<SelectionService>() };
113+ const auto settingsService { std::make_shared<SettingsService>() };
114+ const auto editorService { std::make_shared<EditorService>(selectionService, settingsService) };
115+ const auto utilService { std::make_shared<UtilService>() };
116+ const auto helper { std::make_shared<NoteColumnLineContainerHelper>(automationService, editorService, selectionService, utilService) };
117+
118+ NoteColumnModel model { { 0 , 0 , 0 }, editorService, helper, settingsService };
119+
120+ const int lineCount = 10 ;
121+ NoteColumnModel::LineList lines;
122+ for (int i = 0 ; i < lineCount; ++i) {
123+ lines.push_back (std::make_shared<Line>(static_cast <size_t >(i)));
124+ }
125+ model.setColumnData (lines);
126+
127+ QSignalSpy spy { &model, &NoteColumnModel::dataChanged };
128+ model.updateIndexHighlights ();
129+
130+ QCOMPARE (spy.count (), 1 );
131+ const auto arguments = spy.takeFirst ();
132+ const auto topLeft = arguments.at (0 ).value <QModelIndex>();
133+ const auto bottomRight = arguments.at (1 ).value <QModelIndex>();
134+
135+ const int barLine = static_cast <int >(editorService->positionBarLine ());
136+ QCOMPARE (topLeft.row (), barLine);
137+ QCOMPARE (bottomRight.row (), barLine + lineCount - 1 );
138+ }
139+
109140} // namespace noteahead
110141
111142QTEST_GUILESS_MAIN (noteahead::NoteColumnModelTest)
0 commit comments