mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-07 01:13:50 +02:00
Added tests/notification_test
This commit is contained in:
parent
1a72487e57
commit
18539d5282
1
.gitignore
vendored
1
.gitignore
vendored
@ -111,6 +111,7 @@ tests/db_charset_test
|
||||
tests/getpids_test
|
||||
tests/log_unlink_test
|
||||
tests/mcast_recv_test
|
||||
tests/notification_test
|
||||
tests/rdxml_parse_test
|
||||
tests/reserve_carts_test
|
||||
tests/sas_switch_torture
|
||||
|
@ -18697,5 +18697,6 @@
|
||||
* Fixed a regression in rdgpimon(1) that caused GPIO status
|
||||
to fail to be displayed in the status widgets.
|
||||
2019-05-28 Patrick Linstruth <patrick@deltecent.com>
|
||||
* Added an 'notification_test' test harness.
|
||||
* Added rdmetadata(8) utility for setting cart metadata from the
|
||||
command line.
|
||||
|
@ -37,6 +37,7 @@ noinst_PROGRAMS = audio_convert_test\
|
||||
getpids_test\
|
||||
log_unlink_test\
|
||||
mcast_recv_test\
|
||||
notification_test\
|
||||
rdxml_parse_test\
|
||||
reserve_carts_test\
|
||||
stringcode_test\
|
||||
@ -81,6 +82,10 @@ dist_mcast_recv_test_SOURCES = mcast_recv_test.cpp mcast_recv_test.h
|
||||
nodist_mcast_recv_test_SOURCES = moc_mcast_recv_test.cpp
|
||||
mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
|
||||
|
||||
dist_notification_test_SOURCES = notification_test.cpp notification_test.h
|
||||
nodist_notification_test_SOURCES = moc_notification_test.cpp
|
||||
notification_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
|
||||
|
||||
dist_rdxml_parse_test_SOURCES = rdxml_parse_test.cpp rdxml_parse_test.h
|
||||
rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
|
||||
|
||||
|
70
tests/notification_test.cpp
Normal file
70
tests/notification_test.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
// upload_test.cpp
|
||||
//
|
||||
// Test Rivendell file uploading.
|
||||
//
|
||||
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
#include <rdapplication.h>
|
||||
|
||||
#include "notification_test.h"
|
||||
|
||||
MainObject::MainObject(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
rda=new RDApplication("notification_test","notification_test",NOTIFICATION_TEST_USAGE,this);
|
||||
if(!rda->open(&err_msg)) {
|
||||
fprintf(stderr,"notification_test: %s\n",(const char *)err_msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
|
||||
if(!rda->cmdSwitch()->processed(i)) {
|
||||
fprintf(stderr,"rdrepld: unknown command option \"%s\"\n",
|
||||
(const char *)rda->cmdSwitch()->key(i));
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Run the Test
|
||||
//
|
||||
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
|
||||
this,SLOT(notificationReceivedData(RDNotification *)));
|
||||
rda->ripc()->
|
||||
connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||
}
|
||||
|
||||
|
||||
void MainObject::notificationReceivedData(RDNotification *notify)
|
||||
{
|
||||
printf("%s\n",(const char *)notify->write());
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new MainObject();
|
||||
return a.exec();
|
||||
}
|
43
tests/notification_test.h
Normal file
43
tests/notification_test.h
Normal file
@ -0,0 +1,43 @@
|
||||
// upload_test.h
|
||||
//
|
||||
// Test Rivendell Notifications
|
||||
//
|
||||
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef NOTIFICATION_TEST_H
|
||||
#define NOTIFICATION_TEST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <rdripc.h>
|
||||
|
||||
#define NOTIFICATION_TEST_USAGE ""
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainObject(QObject *parent=0);
|
||||
|
||||
private slots:
|
||||
void notificationReceivedData(RDNotification *notify);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // NOTIFICATION_TEST_H
|
Loading…
x
Reference in New Issue
Block a user