File indexing completed on 2024-04-28 16:13:23
0001 /* 0002 SPDX-FileCopyrightText: 2018 Ralf Habacker ralf.habacker @freenet.de 0003 0004 This file is part of libalkimia. 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #include "alkonlinequotetest.h" 0010 0011 #include "alkonlinequote.h" 0012 #include "alkonlinequotesprofile.h" 0013 #include "alkquotereceiver.h" 0014 #include "alkwebpage.h" 0015 0016 #include <QtTest/QtTest> 0017 0018 QTEST_MAIN(AlkOnlineQuoteTest) 0019 0020 void AlkOnlineQuoteTest::init() 0021 { 0022 m_profile = new AlkOnlineQuotesProfile("alkimia"); 0023 } 0024 0025 void AlkOnlineQuoteTest::cleanup() 0026 { 0027 delete m_profile; 0028 } 0029 0030 void AlkOnlineQuoteTest::testQuoteSources() 0031 { 0032 QStringList sources = m_profile->quoteSources(); 0033 qDebug() << sources; 0034 QVERIFY(sources.size() > 0); 0035 } 0036 0037 void AlkOnlineQuoteTest::testLaunch() 0038 { 0039 AlkOnlineQuote quote(m_profile); 0040 convertertest::AlkQuoteReceiver receiver("e); 0041 receiver.setVerbose(true); 0042 0043 foreach(const QString &source, m_profile->quoteSources()) 0044 if (!source.endsWith(QLatin1String(".webkit"))) 0045 QVERIFY(quote.launch("EUR USD", "EUR USD", source)); 0046 } 0047 0048 void AlkOnlineQuoteTest::testLaunchWithBrowser() 0049 { 0050 #if defined(BUILD_WITH_WEBKIT) || defined(BUILD_WITH_WEBENGINE) 0051 AlkOnlineQuote quote(m_profile); 0052 convertertest::AlkQuoteReceiver receiver("e); 0053 receiver.setVerbose(true); 0054 0055 foreach(const QString &source, m_profile->quoteSources()) 0056 if (source.endsWith(QLatin1String(".webkit"))) 0057 QVERIFY(quote.launch("EUR USD", "EUR USD", source)); 0058 #else 0059 QSKIP("Brower based tests skipped because requirements are not met", SkipAll); 0060 #endif 0061 }