~smspillaz/compiz-plugins-main/compiz-plugins-main.fix_939228

« back to all changes in this revision

Viewing changes to wall/src/offset_movement/tests/test-wall-offset-movement.cpp

  • Committer: smspillaz
  • Date: 2012-04-24 13:01:14 UTC
  • Revision ID: sam.spilsbury@canonical.com-20120424130114-sng6c43ulxxhrxz4
checkinĀ missingĀ files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <gtest/gtest.h>
 
2
#include <gmock/gmock.h>
 
3
 
 
4
#include "offset-movement.h"
 
5
 
 
6
class WallOffsetMovementTest :
 
7
    public ::testing::Test
 
8
{
 
9
};
 
10
 
 
11
TEST(WallOffsetMovementTest, TestOffsetRight)
 
12
{
 
13
    CompRect sbr (750, 0, 500, 500);
 
14
    CompRegion sr (0, 0, 1000, 1000);
 
15
 
 
16
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
17
 
 
18
    EXPECT_EQ (offset, CompPoint (-250, 0));
 
19
}
 
20
 
 
21
TEST(WallOffsetMovementTest, TestOffsetLeft)
 
22
{
 
23
    CompRect sbr (-250, 0, 500, 500);
 
24
    CompRegion sr (0, 0, 1000, 1000);
 
25
 
 
26
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
27
 
 
28
    EXPECT_EQ (offset, CompPoint (250, 0));
 
29
}
 
30
 
 
31
TEST(WallOffsetMovementTest, TestOffsetTop)
 
32
{
 
33
    CompRect sbr (0, -250, 500, 500);
 
34
    CompRegion sr (0, 0, 1000, 1000);
 
35
 
 
36
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
37
 
 
38
    EXPECT_EQ (offset, CompPoint (0, 250));
 
39
}
 
40
 
 
41
TEST(WallOffsetMovementTest, TestOffsetBottom)
 
42
{
 
43
    CompRect sbr (0, 750, 500, 500);
 
44
    CompRegion sr (0, 0, 1000, 1000);
 
45
 
 
46
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
47
 
 
48
    EXPECT_EQ (offset, CompPoint (0, -250));
 
49
}
 
50
 
 
51
TEST(WallOffsetMovementTest, TestOffsetRightMMSlice)
 
52
{
 
53
    CompRect sbr (750, 0, 500, 500);
 
54
    CompRegion sr (0, 0, 1000, 1000);
 
55
 
 
56
    sr -= CompRegion (400, 0, 200, 0);
 
57
 
 
58
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
59
 
 
60
    EXPECT_EQ (offset, CompPoint (-250, 0));
 
61
}
 
62
 
 
63
TEST(WallOffsetMovementTest, TestOffsetLeftMMSlice)
 
64
{
 
65
    CompRect sbr (-250, 0, 500, 500);
 
66
    CompRegion sr (0, 0, 1000, 1000);
 
67
 
 
68
    sr -= CompRegion (400, 0, 200, 0);
 
69
 
 
70
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
71
 
 
72
    EXPECT_EQ (offset, CompPoint (250, 0));
 
73
}
 
74
 
 
75
TEST(WallOffsetMovementTest, TestOffsetTopMMSlice)
 
76
{
 
77
    CompRect sbr (0, -250, 500, 500);
 
78
    CompRegion sr (0, 0, 1000, 1000);
 
79
 
 
80
    sr -= CompRegion (400, 0, 200, 0);
 
81
 
 
82
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
83
 
 
84
    EXPECT_EQ (offset, CompPoint (0, 250));
 
85
}
 
86
 
 
87
TEST(WallOffsetMovementTest, TestOffsetBottomMMSlice)
 
88
{
 
89
    CompRect sbr (0, 750, 500, 500);
 
90
    CompRegion sr (0, 0, 1000, 1000);
 
91
 
 
92
    sr -= CompRegion (400, 0, 200, 0);
 
93
 
 
94
    CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr);
 
95
 
 
96
    EXPECT_EQ (offset, CompPoint (0, -250));
 
97
}