Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed encoding of group list indices for OpenGD77 channels. #559

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/opengd77base_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ OpenGD77BaseCodeplug::ChannelElement::clear() {
enablePowerSave(false);
enableBeep(false);
clearDMRId();
setGroupListIndex(0);
clearGroupListIndex();
setColorCode(0);
clearAPRSIndex();
clearTXContact();
Expand Down
31 changes: 31 additions & 0 deletions test/opengd77_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,37 @@ OpenGD77Test::testChannelFrequency() {
}


void
OpenGD77Test::testChannelGroupList() {
ErrorStack err;

Config config, decoded;
if (! config.readYAML(":/data/config_test.yaml", err))
QFAIL(QString("Cannot open codeplug file: %1")
.arg(err.format()).toLocal8Bit().constData());

config.channelList()->channel(0)->as<DMRChannel>()->setGroupListObj(nullptr);
config.channelList()->channel(0)->as<DMRChannel>()->setTXContactObj(nullptr);
config.channelList()->channel(1)->as<DMRChannel>()->setTXContactObj(nullptr);
config.channelList()->channel(2)->as<DMRChannel>()->setGroupListObj(nullptr);

if (! encodeDecode(config, decoded, err))
QFAIL(err.format().toLocal8Bit().constData());

QVERIFY(decoded.channelList()->channel(0)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(decoded.channelList()->channel(0)->as<DMRChannel>()->contact()->isNull());

QVERIFY(! decoded.channelList()->channel(1)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(decoded.channelList()->channel(1)->as<DMRChannel>()->contact()->isNull());

QVERIFY(decoded.channelList()->channel(2)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(! decoded.channelList()->channel(2)->as<DMRChannel>()->contact()->isNull());

QVERIFY(! decoded.channelList()->channel(3)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(decoded.channelList()->channel(3)->as<DMRChannel>()->contact()->isNull());
}


void
OpenGD77Test::testChannelPowerSettings() {
ErrorStack err;
Expand Down
2 changes: 2 additions & 0 deletions test/opengd77_test.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ private slots:
void testBasicConfigDecoding();
void testChannelFrequency();

/** Regression test for #539. */
void testChannelGroupList();
/** Regression test for #507 */
void testChannelPowerSettings();
/** Regression test for #541. */
Expand Down
Loading