Line data Source code
1 : /* 2 : * Copyright (C) 2004-2024 Savoir-faire Linux Inc. 3 : * 4 : * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> 5 : * Author: Olivier Gregoire <olivier.gregoire@savoirfairelinux.com> 6 : * 7 : * This program is free software; you can redistribute it and/or modify 8 : * it under the terms of the GNU General Public License as published by 9 : * the Free Software Foundation; either version 3 of the License, or 10 : * (at your option) any later version. 11 : * 12 : * This program is distributed in the hope that it will be useful, 13 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 : * GNU General Public License for more details. 16 : * 17 : * You should have received a copy of the GNU General Public License 18 : * along with this program; if not, write to the Free Software 19 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 : */ 21 : 22 : #include <cppunit/TestAssert.h> 23 : #include <cppunit/TestFixture.h> 24 : #include <cppunit/extensions/HelperMacros.h> 25 : 26 : #include "test_runner.h" 27 : 28 : #include "media/video/video_input.h" 29 : #include "media_const.h" 30 : #include "jami.h" 31 : #include "manager.h" 32 : 33 : #include <map> 34 : #include <string> 35 : 36 : namespace jami { 37 : namespace test { 38 : 39 : class VideoInputTest : public CppUnit::TestFixture 40 : { 41 : public: 42 2 : static std::string name() { return "video_input"; } 43 : 44 1 : VideoInputTest() 45 1 : { 46 1 : libjami::init(libjami::InitFlag(libjami::LIBJAMI_FLAG_DEBUG | libjami::LIBJAMI_FLAG_CONSOLE_LOG)); 47 1 : libjami::start("jami-sample.yml"); 48 1 : } 49 : 50 2 : ~VideoInputTest() { libjami::fini(); } 51 : 52 : private: 53 : void testInput(); 54 : 55 2 : CPPUNIT_TEST_SUITE(VideoInputTest); 56 1 : CPPUNIT_TEST(testInput); 57 4 : CPPUNIT_TEST_SUITE_END(); 58 : }; 59 : 60 : CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(VideoInputTest, VideoInputTest::name()); 61 : 62 : void 63 1 : VideoInputTest::testInput() 64 : { 65 1 : static const std::string sep = libjami::Media::VideoProtocolPrefix::SEPARATOR; 66 2 : std::string resource = libjami::Media::VideoProtocolPrefix::DISPLAY + sep 67 3 : + std::string(getenv("DISPLAY") ?: ":0.0"); 68 2 : video::VideoInput video; 69 1 : libjami::switchInput("", "", resource); 70 1 : } 71 : 72 : } // namespace test 73 : } // namespace jami 74 : 75 1 : RING_TEST_RUNNER(jami::test::VideoInputTest::name());