File: grail.cpp

package info (click to toggle)
grail 3.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,296 kB
  • sloc: sh: 11,416; cpp: 5,636; ansic: 1,587; makefile: 254
file content (66 lines) | stat: -rw-r--r-- 2,197 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <gtest/gtest.h>

#include "oif/grail.h"

TEST(grail, grail) {
  UGHandle grail_handle = NULL;

  ASSERT_EQ(UGStatusSuccess, grail_new(&grail_handle));

  int fd = grail_get_fd(grail_handle);

  RecordProperty("fd", fd);

  UGEvent event = NULL;
  EXPECT_EQ(UGStatusErrorNoEvent, grail_get_event(grail_handle, &event));

  EXPECT_EQ(
      UGStatusErrorInvalidGesture,
      grail_accept_gesture(grail_handle,
                           UGGestureTypeDrag | UGGestureTypePinch |
                           UGGestureTypeRotate | UGGestureTypeTap));
  EXPECT_EQ(UGStatusErrorInvalidGesture,
            grail_accept_gesture(grail_handle, 0));

  UGSubscription subscription;

  ASSERT_EQ(UGStatusSuccess, grail_subscription_new(&subscription));
  unsigned int gesture_mask = UGGestureTypeDrag | UGGestureTypePinch
      | UGGestureTypeRotate | UGGestureTypeTap;
  EXPECT_EQ(
      UGStatusSuccess,
      grail_subscription_set_property(subscription, UGSubscriptionPropertyMask,
                                      &gesture_mask));

  unsigned int min_touches = 2;
  EXPECT_EQ(
      UGStatusSuccess,
      grail_subscription_set_property(subscription,
                                      UGSubscriptionPropertyTouchesMinimum,
                                      &min_touches));

  unsigned int max_touches = 2;
  EXPECT_EQ(
      UGStatusSuccess,
      grail_subscription_set_property(subscription,
                                      UGSubscriptionPropertyTouchesMaximum,
                                      &max_touches));

  unsigned int touches_start = 2;
  EXPECT_EQ(
      UGStatusSuccess,
      grail_subscription_set_property(subscription,
                                      UGSubscriptionPropertyTouchesStart,
                                      &touches_start));

  /* FIXME: Need to create a device and set it in the subscription */
  /*ASSERT_EQ(UGStatusSuccess,
            grail_subscription_activate(grail_handle, subscription)); */

  /* FIXME: Need to generate frame events and send them through */
  /*EXPECT_EQ(UGStatusSuccess,
            grail_accept_gesture(grail_handle, 0));*/

  grail_subscription_delete(subscription);
  grail_delete(grail_handle);
}