File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,14 @@ void MonitorModel::onVisibleChanged(bool visible)
7171
7272void MonitorModel::onXChanged(int x)
7373{
74+ emit xChanged();
75+ emit visibleChanged();
7476}
7577
7678void MonitorModel::onYChanged(int y)
7779{
80+ emit yChanged();
81+ emit visibleChanged();
7882}
7983
8084libscratchcpp::Monitor *MonitorModel::monitor() const
Original file line number Diff line number Diff line change @@ -156,6 +156,13 @@ TEST(MonitorModelTest, X)
156156
157157 monitor.setX(-2);
158158 ASSERT_EQ(model.x(), -2);
159+
160+ QSignalSpy xSpy(&model, &MonitorModel::xChanged);
161+ QSignalSpy visibleSpy(&model, &MonitorModel::visibleChanged);
162+
163+ model.onXChanged(-2);
164+ ASSERT_EQ(xSpy.count(), 1);
165+ ASSERT_EQ(visibleSpy.count(), 1);
159166}
160167
161168TEST(MonitorModelTest, Y)
@@ -168,6 +175,14 @@ TEST(MonitorModelTest, Y)
168175
169176 monitor.setY(-8);
170177 ASSERT_EQ(model.y(), -8);
178+
179+ QSignalSpy ySpy(&model, &MonitorModel::yChanged);
180+ QSignalSpy visibleSpy(&model, &MonitorModel::visibleChanged);
181+
182+ model.onYChanged(-8);
183+ ASSERT_EQ(model.y(), -8);
184+ ASSERT_EQ(ySpy.count(), 1);
185+ ASSERT_EQ(visibleSpy.count(), 1);
171186}
172187
173188TEST(MonitorModelTest, Width)
You can’t perform that action at this time.
0 commit comments