void testQOfonoCellBroadcast()
    {
        QSignalSpy cellPowered(m, SIGNAL(powerChanged(bool)));
        QSignalSpy inBroadcast(m, SIGNAL(incomingBroadcast( QString ,quint16)));
     //   QSignalSpy emBroadcast(m, SIGNAL(emergencyBroadcast( QString , QVariantMap)));
        QSignalSpy topicsSpy(m, SIGNAL(topicsChanged(QString)));

        QOfonoModem modem;
        modem.setModemPath(m->modemPath());
        qDebug() << modem.powered() << m->topics();
        bool isPowered = modem.powered();
        modem.setPowered(!isPowered);
        QTest::qWait(2000);
        QCOMPARE(cellPowered.count(), 1);
        QVariantList list = cellPowered.takeFirst();
        QCOMPARE(list.at(0).toBool(), !isPowered);
        QCOMPARE(modem.powered(),!isPowered);

        modem.setPowered(true);

        qDebug() << "Please send CBM using phonesim";
        QTest::qWait(10000);

//        QCOMPARE(emBroadcast.count(), 1);
        QCOMPARE(inBroadcast.count(), 1);
        QVariantList list2 = cellPowered.takeFirst();
        qDebug() << list2.at(0).toString();

        QString topicsList = "20,50-51,60";
        m->setTopics("");
        m->setTopics(topicsList);
        qDebug() << modem.powered() << m->topics();
        QTest::qWait(4000);
        QCOMPARE(topicsSpy.count(), 1);
    }
    void testQOfonoCallVolume()
    {

        QSignalSpy mutedChanged(m, SIGNAL(mutedChanged(const bool)));
        QSignalSpy speakerVolumeChanged(m, SIGNAL(speakerVolumeChanged(const quint8)));
        QSignalSpy microphoneVolumeChanged(m, SIGNAL(microphoneVolumeChanged(const quint8)));
        QSignalSpy spfail(m, SIGNAL(setSpeakerVolumeFailed()));
        QSignalSpy mvfail(m, SIGNAL(setMicrophoneVolumeFailed()));

        QOfonoModem modem;
        modem.setModemPath(m->modemPath());
        modem.setPowered(false);
        QTest::qWait(5000);
        modem.setPowered(true);
        QTest::qWait(5000);
        modem.setOnline(true);
        QTest::qWait(5000);

        m->setMuted(true);
        QTest::qWait(2000);
        QCOMPARE(mutedChanged.count(), 1);
        QVERIFY(mutedChanged.takeFirst().at(0).toBool()==bool(true));
        QVERIFY(m->muted()==bool(true));

        m->setMuted(false);
        QTest::qWait(2000);
        QCOMPARE(mutedChanged.count(), 1);
        QVERIFY(mutedChanged.takeFirst().at(0).toBool()==bool(false));
        QVERIFY(m->muted()==bool(false));


        m->setSpeakerVolume(quint8(15));
        QTest::qWait(2000);
        QCOMPARE(speakerVolumeChanged.count(), 1);
        QCOMPARE(quint8(speakerVolumeChanged.takeFirst().at(0).toUInt()), quint8(15));
        QCOMPARE(m->speakerVolume(),quint8(15));

        m->setSpeakerVolume(quint8(250));
        QTest::qWait(2000);
        QCOMPARE(spfail.count(), 1);

        m->setMicrophoneVolume(quint8(10));
        QTest::qWait(2000);
        QCOMPARE(mvfail.count(), 1);

    }
Beispiel #3
0
    void testQOfonoManagerAddRemove()
    {
        QSignalSpy add(mm, SIGNAL(modemAdded(const QString &)));
        QSignalSpy remove(mm, SIGNAL(modemRemoved(const QString &)));
        qDebug() << "Please stop oFono and then start it again";
	for (int i=0; i<30; i++) {
	    if (add.count() > 0 && remove.count() > 0)
	        break;
        QTest::qWait(1000);
	}
        QVERIFY(mm->modems().contains("/phonesim") == true);
        QOfonoModem *m = new QOfonoModem(this);
        m->setModemPath("/phonesim");
        m->setPowered(true);
        QTest::qWait(5000);
        m->setOnline(true);
        QTest::qWait(5000);
        QVERIFY(remove.count() > 0);
	QVERIFY(add.count() > 0);
    }