2 * Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #include "libds-tests.h"
26 #include "DSCompositor.h"
28 using namespace display_server;
30 class DSSeatTest : public ::testing::Test
33 void SetUp(void) override
35 char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
36 setenv("XDG_RUNTIME_DIR", xdir, 1);
38 void TearDown(void) override
40 unsetenv("XDG_RUNTIME_DIR");
44 class MockCompositor : public DSCompositor
50 std::shared_ptr<DSCanvas> _onInitialized() override
52 auto canvas = std::make_shared<DSCanvas>();
56 void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
59 void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
62 void _onInputAdded(std::shared_ptr<DSInput> input) override
65 void _onInputRemoved(std::shared_ptr<DSInput> input) override
69 TEST_F(DSSeatTest, NewDSSeat)
71 DSSeat *seat = new DSSeat();
73 EXPECT_TRUE(seat != nullptr);
79 TEST_F(DSSeatTest, BasicMethods)
81 std::string seatName{"default"};
82 std::shared_ptr<DSCompositor> compositor = std::make_shared<MockCompositor>();
83 EXPECT_TRUE(compositor != nullptr);
87 std::shared_ptr<DSSeat> seat = std::make_shared<DSSeat>(compositor.get(), seatName);
88 EXPECT_TRUE(seat != nullptr);