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