Skip to content

Commit

Permalink
Fix TestIPTVRecorder after change to IPTVChannelInfo
Browse files Browse the repository at this point in the history
In a60e7429a09a ("IPTVChannelInfo: explictly set IPTVTuningData protocol to
invalid") I removed `IPTVChannelInfo::IsValid()` thinking it was unused but
missed the uses in these test cases. Reintroduce the method, but make it
`protected` and a friend of the `TestIPTVRecorder` class.

The above change also changed the behaviour of `IPTVChannelInfo`'s constructors
such that the protocol is not always probed, and therefore `IsValid()` is not
necessarily true. This is the case when constructed via
`IPTVChannelFetcher::ParsePlayList`. Update `TestIPTVRecorder::ParseChanInfo` to
reflect this by now asserting that the tuning data is not valid and that the
protocol is `inValid` as expected.

Refs #13488

Signed-off-by: Paul Harrison <pharrison@mythtv.org>
  • Loading branch information
ijc authored and Paul Harrison committed Oct 6, 2019
1 parent a2ac6aa commit 36d96c9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.h
Expand Up @@ -44,6 +44,13 @@ class IPTVChannelInfo
{
}

protected:
friend class TestIPTVRecorder;
bool IsValid(void) const
{
return !m_name.isEmpty() && m_tuning.IsValid();
}

public:
QString m_name;
QString m_xmltvid;
Expand Down
5 changes: 5 additions & 0 deletions mythtv/libs/libmythtv/iptvtuningdata.h
Expand Up @@ -218,6 +218,11 @@ class MTV_PUBLIC IPTVTuningData
m_protocol = IPTVTuningData::inValid;
}

IPTVProtocol GetProtocol(void) const
{
return m_protocol;
}

protected:
bool IsHLSPlaylist(void) const
{
Expand Down
40 changes: 24 additions & 16 deletions mythtv/libs/libmythtv/test/test_iptvrecorder/test_iptvrecorder.h
Expand Up @@ -163,51 +163,59 @@ class TestIPTVRecorder: public QObject
/* test plain old MPEG-2 TS over multicast playlist */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataUDP, nullptr);
QCOMPARE (chanmap["001"].m_name, QString ("La 1"));
QVERIFY (chanmap["001"].IsValid ());
QVERIFY (chanmap["001"].m_tuning.IsValid ());
QVERIFY (!chanmap["001"].IsValid ());
QVERIFY (!chanmap["001"].m_tuning.IsValid ());
QCOMPARE (chanmap["001"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["001"].m_tuning.GetDataURL().toString(), QString ("udp://239.0.0.76:8208"));

/* test playlist for Neutrino STBs */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataHTTP, nullptr);
QVERIFY (chanmap["1"].IsValid ());
QVERIFY (chanmap["1"].m_tuning.IsValid ());
QVERIFY (!chanmap["1"].IsValid ());
QVERIFY (!chanmap["1"].m_tuning.IsValid ());
QCOMPARE (chanmap["1"].m_name, QString ("SVT1 HD Mitt"));
QCOMPARE (chanmap["1"].m_xmltvid, QString ("svt1hd.svt.se"));
QCOMPARE (chanmap["1"].m_programNumber, (uint) 1330);
QCOMPARE (chanmap["1"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["1"].m_tuning.GetDataURL().toString(), QString ("http://192.168.0.234:8001/1:0:19:532:6:22F1:EEEE0000:0:0:0:"));

/* test playlist for FreeboxTV, last channel in playlist "wins" */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataRTSP, nullptr);
QVERIFY (chanmap["2"].IsValid ());
QVERIFY (chanmap["2"].m_tuning.IsValid ());
QVERIFY (!chanmap["2"].IsValid ());
QVERIFY (!chanmap["2"].m_tuning.IsValid ());
QCOMPARE (chanmap["2"].m_name, QString ("France 2 (auto)"));
QCOMPARE (chanmap["2"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["2"].m_tuning.GetDataURL().toString(), QString ("rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=201"));

/* test playlist for SAT>IP with "#. name" instead of "# - name" */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataSATIP, nullptr);
QVERIFY (chanmap["10"].IsValid ());
QVERIFY (chanmap["10"].m_tuning.IsValid ());
QVERIFY (!chanmap["10"].IsValid ());
QVERIFY (!chanmap["10"].m_tuning.IsValid ());
QCOMPARE (chanmap["10"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["10"].m_name, QString ("ZDFinfokanal"));

/* test playlist from A1 TV with empty lines and tvg-num */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataA1TV, nullptr);
QVERIFY (chanmap["1"].IsValid ());
QVERIFY (chanmap["1"].m_tuning.IsValid ());
QVERIFY (!chanmap["1"].IsValid ());
QVERIFY (!chanmap["1"].m_tuning.IsValid ());
QCOMPARE (chanmap["1"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["1"].m_name, QString ("ORFeins"));

/* test playlist from Movistar TV with channel number in braces */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataMovistarTV, nullptr);
QVERIFY (chanmap["001"].IsValid ());
QVERIFY (chanmap["001"].m_tuning.IsValid ());
QVERIFY (!chanmap["001"].IsValid ());
QVERIFY (!chanmap["001"].m_tuning.IsValid ());
QCOMPARE (chanmap["001"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["001"].m_name, QString ("La 1"));
QVERIFY (chanmap["2275"].IsValid ());
QVERIFY (chanmap["2275"].m_tuning.IsValid ());
QVERIFY (!chanmap["2275"].IsValid ());
QVERIFY (!chanmap["2275"].m_tuning.IsValid ());
QCOMPARE (chanmap["2275"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["2275"].m_name, QString ("Canal Sur Andalucía"));

/* test playlist from iptv.ink with channel number in duration */
chanmap = IPTVChannelFetcher::ParsePlaylist (rawdataIPTVInk, nullptr);
QVERIFY (chanmap["0002"].IsValid ());
QVERIFY (chanmap["0002"].m_tuning.IsValid ());
QVERIFY (!chanmap["0002"].IsValid ());
QVERIFY (!chanmap["0002"].m_tuning.IsValid ());
QCOMPARE (chanmap["0002"].m_tuning.GetProtocol(), IPTVTuningData::inValid);
QCOMPARE (chanmap["0002"].m_name, QString ("[COLOR gold]Das Erste[/COLOR]"));
}

Expand Down

0 comments on commit 36d96c9

Please sign in to comment.