MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / main

Function main

tests/slice_model_letter_test.cpp:33–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int main(int argc, char** argv)
34{
35 QCoreApplication app(argc, argv);
36
37 // ── Fallback: letter() returns 'A' + sliceId when index_letter hasn't
38 // arrived yet (older firmware, early in status sequence).
39 {
40 SliceModel s(2);
41 EXPECT_EQ(s.letter(), QString("C")); // 'A' + 2
42 }
43
44 // ── applyStatus("index_letter=A") populates the radio-given letter
45 // and emits letterChanged with the resolved value.
46 {
47 SliceModel s(3);
48 QSignalSpy spy(&s, &SliceModel::letterChanged);
49 s.applyStatus(kv({{"index_letter", "A"}}));
50 EXPECT_EQ(s.letter(), QString("A"));
51 EXPECT_EQ(spy.count(), 1);
52 EXPECT_EQ(spy.takeFirst().at(0).toString(), QString("A"));
53 }
54
55 // ── Re-applying the same letter does NOT re-emit letterChanged.
56 {
57 SliceModel s(1);
58 s.applyStatus(kv({{"index_letter", "B"}}));
59 QSignalSpy spy(&s, &SliceModel::letterChanged);
60 s.applyStatus(kv({{"index_letter", "B"}}));
61 EXPECT_EQ(spy.count(), 0);
62 }
63
64 // ── Letter change emits exactly once and the resolved value follows.
65 {
66 SliceModel s(2);
67 s.applyStatus(kv({{"index_letter", "A"}}));
68 QSignalSpy spy(&s, &SliceModel::letterChanged);
69 s.applyStatus(kv({{"index_letter", "C"}}));
70 EXPECT_EQ(s.letter(), QString("C"));
71 EXPECT_EQ(spy.count(), 1);
72 EXPECT_EQ(spy.takeFirst().at(0).toString(), QString("C"));
73 }
74
75 // ── emitLetterRefresh() forces a re-emission with the current value
76 // (used when a display preference changes).
77 {
78 SliceModel s(0);
79 s.applyStatus(kv({{"index_letter", "A"}}));
80 QSignalSpy spy(&s, &SliceModel::letterChanged);
81 s.emitLetterRefresh();
82 EXPECT_EQ(spy.count(), 1);
83 EXPECT_EQ(spy.takeFirst().at(0).toString(), QString("A"));
84 }
85
86 // ── Status messages without index_letter don't disturb the stored
87 // letter or emit on letterChanged.
88 {
89 SliceModel s(2);
90 s.applyStatus(kv({{"index_letter", "A"}}));

Callers

nothing calls this directly

Calls 15

kvFunction · 0.85
letterMethod · 0.80
countMethod · 0.80
emitLetterRefreshMethod · 0.80
audioPanMethod · 0.80
flexAudioPanMethod · 0.80
setAudioPanMethod · 0.80
agcModeMethod · 0.80
agcThresholdMethod · 0.80
agcOffLevelMethod · 0.80
squelchOnMethod · 0.80

Tested by

no test coverage detected