~ci-train-bot/unity/unity-ubuntu-zesty-2101

« back to all changes in this revision

Viewing changes to tests/test_xdnd_start_stop_notifier_imp.cpp

  • Committer: Bileto Bot
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2016-10-27 08:40:57 UTC
  • mfrom: (4192.1.1 trunk)
  • Revision ID: ci-train-bot@canonical.com-20161027084057-6swa0d20ausc90ix
TestXdndStartStopNotifierImp: enable some unstable tests by adding XTest support

Approved by: Andrea Azzarone

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include <Nux/Nux.h>
26
26
#include <X11/Xlib.h>
27
 
//#include <X11/extensions/XTest.h>
 
27
#include <X11/extensions/XTest.h>
28
28
 
29
29
#include "unity-shared/WindowManager.h"
30
30
#include "test_utils.h"
47
47
  unity::XdndStartStopNotifierImp xdnd_start_stop_notifier;
48
48
};
49
49
 
50
 
TEST_F(TestXdndStartStopNotifierImp, UNSTABLE_TEST(SignalStarted))
 
50
TEST_F(TestXdndStartStopNotifierImp, SignalStarted)
51
51
{
52
52
  bool signal_received = false;
53
53
  xdnd_start_stop_notifier.started.connect([&](){
55
55
  });
56
56
 
57
57
  XSetSelectionOwner(display_, selection_, owner_, CurrentTime);
58
 
  //XTestFakeButtonEvent(display_, 1, True, CurrentTime);
 
58
  XTestFakeButtonEvent(display_, 1, True, CurrentTime);
59
59
  auto& wm = unity::WindowManager::Default();
60
60
  wm.window_mapped.emit(0);
61
61
 
62
62
  Utils::WaitUntil(signal_received);
63
 
  //XTestFakeButtonEvent(display_, 1, False, CurrentTime);
 
63
  XTestFakeButtonEvent(display_, 1, False, CurrentTime);
64
64
}
65
65
 
66
 
TEST_F(TestXdndStartStopNotifierImp, UNSTABLE_TEST(SignalFinished))
 
66
TEST_F(TestXdndStartStopNotifierImp, SignalFinished)
67
67
{
68
68
  bool signal_received = false;
69
69
  xdnd_start_stop_notifier.finished.connect([&](){
71
71
  });
72
72
 
73
73
  XSetSelectionOwner(display_, selection_, owner_, CurrentTime);
74
 
  //XTestFakeButtonEvent(display_, 1, True, CurrentTime);
 
74
  XTestFakeButtonEvent(display_, 1, True, CurrentTime);
75
75
  auto& wm = unity::WindowManager::Default();
76
76
  wm.window_mapped.emit(0);
77
77
 
78
78
  Utils::WaitForTimeoutMSec(500);
79
79
 
80
80
  XSetSelectionOwner(display_, selection_, None, CurrentTime);
81
 
  //XTestFakeButtonEvent(display_, 1, False, CurrentTime);
 
81
  XTestFakeButtonEvent(display_, 1, False, CurrentTime);
82
82
  wm.window_unmapped.emit(0);
83
83
 
84
84
  Utils::WaitUntil(signal_received);
85
85
}
86
86
 
87
 
TEST_F(TestXdndStartStopNotifierImp, DISABLED_SignalFinished_QT)
 
87
TEST_F(TestXdndStartStopNotifierImp, SignalFinished_QT)
88
88
{
89
89
  bool signal_received = false;
90
 
  xdnd_start_stop_notifier.finished.connect([&](){
 
90
  xdnd_start_stop_notifier.finished.connect([&signal_received] {
91
91
    signal_received = true;
92
92
  });
93
93
 
94
94
  XSetSelectionOwner(display_, selection_, owner_, CurrentTime);
95
 
  //XTestFakeButtonEvent(display_, 1, True, CurrentTime);
 
95
  XTestFakeButtonEvent(display_, 1, True, CurrentTime);
96
96
  auto& wm = unity::WindowManager::Default();
97
97
  wm.window_mapped.emit(0);
98
98
 
99
99
  Utils::WaitForTimeoutMSec(500);
100
100
 
101
 
  //XTestFakeButtonEvent(display_, 1, False, CurrentTime);
 
101
  XTestFakeButtonEvent(display_, 1, False, CurrentTime);
102
102
  wm.window_unmapped.emit(0);
103
103
 
104
104
  Utils::WaitUntil(signal_received);