Skip to content
Open
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
10 changes: 2 additions & 8 deletions src/dxcluster/dxcluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,9 @@ void DXClusterWidget::printSpot(const QString _stringSpot)
spot.setColor(dxSpotColor);
}

int callPad = 15;
if (spot.getDxCall().length()>11)
callPad = spot.getDxCall().length() + 3;
QString paddedDXCall = spot.getDxCall().leftJustified(callPad, ' ');
QString paddedDXCall = spot.getDxCall().leftJustified(15, ' ');
QString paddedFreq = ((spot.getFrequency()).toQString(MHz)).rightJustified(10, ' ');
callPad = 10;
if (spot.getSpotter().length()>11)
callPad = spot.getSpotter().length() + 3;
QString paddedSpotter = QString(spot.getSpotter()+ ":").leftJustified(callPad, ' ');
QString paddedSpotter = QString(spot.getSpotter()+ ":").leftJustified(10, ' ');
QString paddedComments = QString(spot.getComment()).leftJustified(28, ' ');
QString dateformat;
if (spot.getSHDX())
Expand Down
23 changes: 23 additions & 0 deletions tests/tst_dxcluster/tst_dxcluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ private slots:
void test_setDXAssistantEnabledDoesNotEmitBack();
void test_dxAssistantButtonTextAndToolTip();

// Q) printSpot - regression for issue #1142
void test_printSpot_longDXCallKeepsColumnsAligned();

private:
// Helper: build an EntityStatus with the given QSOStatus and bandId=-1.
// bandId=-1 guarantees that no band-based filter can interfere with the
Expand Down Expand Up @@ -803,5 +806,25 @@ void tst_DXCluster::test_dxAssistantButtonTextAndToolTip()
QCOMPARE(local.dxAssistantButton->toolTip(), QString("Enable/Disable DX Assistant"));
}

// ─────────────────────────────────────────────────────────────────────────────
// Q) printSpot - regression for issue #1142
// The DX call column used to grow on rows with a long call, shifting the
// comment and time columns of that row only.
// ─────────────────────────────────────────────────────────────────────────────

void tst_DXCluster::test_printSpot_longDXCallKeepsColumnsAligned()
{
widget->setDXClusterSpotConfig(true, true, true, true, true, true, true, true);
widget->dxClusterListWidget->clear();
widget->printSpot("DX de EA4K: 14025.0 IZ3WUW CQ 1429Z");
widget->printSpot("DX de EA4K: 14025.0 VP2V/W1ABC/MM CQ 1430Z");
QCOMPARE(widget->dxClusterListWidget->count(), 2);

// The newest spot is inserted on top
const QString longCallRow = widget->dxClusterListWidget->item(0)->text();
const QString shortCallRow = widget->dxClusterListWidget->item(1)->text();
QCOMPARE(longCallRow.indexOf("CQ"), shortCallRow.indexOf("CQ"));
}

QTEST_MAIN(tst_DXCluster)
#include "tst_dxcluster.moc"