#include "libds-tests.h"
#include "DSSeat.h"
#include "DSCompositor.h"
+#include "DSZone.h"
using namespace display_server;
delete seat;
}
-TEST_F(DSSeatTest, BasicMethods)
+TEST_F(DSSeatTest, GetName)
{
std::string seatName{"default"};
- std::shared_ptr<DSCompositor> compositor = std::make_shared<MockCompositor>();
+ auto compositor = std::make_shared<MockCompositor>();
EXPECT_TRUE(compositor != nullptr);
if (compositor)
{
- std::shared_ptr<DSSeat> seat = std::make_shared<DSSeat>(compositor.get(), seatName);
+ auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
EXPECT_TRUE(seat != nullptr);
+
+ if (seat)
+ {
+ EXPECT_TRUE(seat->getName().compare(seatName) == 0);
+ }
+ }
+}
+
+TEST_F(DSSeatTest, HasPointerKeyboardTouch)
+{
+ std::string seatName{"default"};
+ auto compositor = std::make_shared<MockCompositor>();
+ EXPECT_TRUE(compositor != nullptr);
+
+ if (compositor)
+ {
+ auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
+ EXPECT_TRUE(seat != nullptr);
+
+ if (seat)
+ {
+ seat->addPointer();
+ seat->addKeyboard();
+ seat->addTouch();
+
+ EXPECT_TRUE(seat->hasPointer() == true);
+ EXPECT_TRUE(seat->hasKeyboard() == true);
+ EXPECT_TRUE(seat->hasTouch() == true);
+
+ seat->removePointer();
+ seat->removeKeyboard();
+ seat->removeTouch();
+ }
}
}
+
+TEST_F(DSSeatTest, AttachGetDetachZone)
+{
+ std::string seatName{"default"};
+ auto compositor = std::make_shared<MockCompositor>();
+ EXPECT_TRUE(compositor != nullptr);
+
+ if (compositor)
+ {
+ auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
+ EXPECT_TRUE(seat != nullptr);
+
+ if (seat)
+ {
+ auto zone = std::make_shared<DSZone>();
+ EXPECT_TRUE(zone != nullptr);
+
+ if (zone)
+ {
+ EXPECT_TRUE(seat->attachZone(zone) == true);
+ EXPECT_TRUE(seat->getZone().get() == zone.get());
+ EXPECT_TRUE(seat->detachZone() == true);
+ }
+ }
+ }
+}
+
+TEST_F(DSSeatTest, GetXKB)
+{
+ std::string seatName{"default"};
+ auto compositor = std::make_shared<MockCompositor>();
+ EXPECT_TRUE(compositor != nullptr);
+
+ if (compositor)
+ {
+ auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
+ EXPECT_TRUE(seat != nullptr);
+
+ if (seat)
+ {
+ EXPECT_TRUE(seat->getXkb() != nullptr);
+ }
+ }
+}
+
+TEST_F(DSSeatTest, getTopWindow)
+{
+ std::string seatName{"default"};
+ auto compositor = std::make_shared<MockCompositor>();
+ EXPECT_TRUE(compositor != nullptr);
+
+ if (compositor)
+ {
+ auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
+ EXPECT_TRUE(seat != nullptr);
+
+ if (seat)
+ {
+ auto zone = std::make_shared<DSZone>();
+ EXPECT_TRUE(zone != nullptr);
+
+ if (zone)
+ {
+ EXPECT_TRUE(seat->attachZone(zone) == true);
+
+ auto winTop = seat->getTopWindow(nullptr);
+ EXPECT_TRUE(winTop == nullptr);
+
+ auto winTopOnPosition = seat->getTopWindowOnPosition(100, 100);
+ EXPECT_TRUE(winTopOnPosition == nullptr);
+
+ EXPECT_TRUE(seat->detachZone() == true);
+ }
+ }
+ }
+}
+