aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-04 08:57:20 +0100
committermarha <marha@users.sourceforge.net>2011-11-04 08:57:20 +0100
commit02f377d5e2dd18537d0807ad63675a0970b5a37d (patch)
tree1814c826db4d95a30ad71431d9c84b8d2611ec18 /xorg-server/test
parent6f4feafd4d22beaabfb0202e66b0dea9047ee084 (diff)
downloadvcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.gz
vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.bz2
vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.zip
xserver pixman mesa git update 4 nov 2011
Diffstat (limited to 'xorg-server/test')
-rw-r--r--xorg-server/test/misc.c104
-rw-r--r--xorg-server/test/xfree86.c26
-rw-r--r--xorg-server/test/xi2/protocol-common.c1
-rw-r--r--xorg-server/test/xi2/protocol-eventconvert.c4
-rw-r--r--xorg-server/test/xi2/protocol-xiquerydevice.c6
5 files changed, 135 insertions, 6 deletions
diff --git a/xorg-server/test/misc.c b/xorg-server/test/misc.c
index 3d3b1a1e3..d98449ba0 100644
--- a/xorg-server/test/misc.c
+++ b/xorg-server/test/misc.c
@@ -27,6 +27,9 @@
#include <stdint.h>
#include "misc.h"
+#include "scrnintstr.h"
+
+ScreenInfo screenInfo;
static void dix_version_compare(void)
{
@@ -54,9 +57,110 @@ static void dix_version_compare(void)
assert(rc < 0);
}
+static void dix_update_desktop_dimensions(void)
+{
+ int i;
+ int x, y, w, h;
+ int w2, h2;
+ ScreenRec screens[MAXSCREENS];
+
+ for (i = 0; i < MAXSCREENS; i++)
+ screenInfo.screens[i] = &screens[i];
+
+ x = 0;
+ y = 0;
+ w = 10;
+ h = 5;
+ w2 = 35;
+ h2 = 25;
+
+#define assert_dimensions(_x, _y, _w, _h) \
+ update_desktop_dimensions(); \
+ printf("%d %d %d %d\n", screenInfo.x, screenInfo.y, screenInfo.width, screenInfo.height); \
+ assert(screenInfo.x == _x); \
+ assert(screenInfo.y == _y); \
+ assert(screenInfo.width == _w); \
+ assert(screenInfo.height == _h);
+
+#define set_screen(idx, _x, _y, _w, _h) \
+ screenInfo.screens[idx]->x = _x; \
+ screenInfo.screens[idx]->y = _y; \
+ screenInfo.screens[idx]->width = _w; \
+ screenInfo.screens[idx]->height = _h; \
+
+ printf("Testing\n");
+
+ /* single screen */
+ screenInfo.numScreens = 1;
+ set_screen(0, x, y, w, h);
+ assert_dimensions(x, y, w, h);
+
+ /* dualhead rightof */
+ screenInfo.numScreens = 2;
+ set_screen(1, w, 0, w2, h2);
+ assert_dimensions(x, y, w + w2, h2);
+
+ /* dualhead belowof */
+ screenInfo.numScreens = 2;
+ set_screen(1, 0, h, w2, h2);
+ assert_dimensions(x, y, w2, h + h2);
+
+ /* triplehead L shape */
+ screenInfo.numScreens = 3;
+ set_screen(1, 0, h, w2, h2);
+ set_screen(2, w2, h2, w, h);
+ assert_dimensions(x, y, w + w2, h + h2);
+
+ /* quadhead 2x2 */
+ screenInfo.numScreens = 4;
+ set_screen(1, 0, h, w, h);
+ set_screen(2, w, h, w, h2);
+ set_screen(3, w, 0, w2, h);
+ assert_dimensions(x, y, w + w2, h + h2);
+
+ /* quadhead horiz line */
+ screenInfo.numScreens = 4;
+ set_screen(1, w, 0, w, h);
+ set_screen(2, 2 * w, 0, w, h);
+ set_screen(3, 3 * w, 0, w, h);
+ assert_dimensions(x, y, 4 * w, h);
+
+ /* quadhead vert line */
+ screenInfo.numScreens = 4;
+ set_screen(1, 0, h, w, h);
+ set_screen(2, 0, 2 * h, w, h);
+ set_screen(3, 0, 3 * h, w, h);
+ assert_dimensions(x, y, w, 4 * h);
+
+
+ /* x overlap */
+ screenInfo.numScreens = 2;
+ set_screen(0, 0, 0, w2, h2);
+ set_screen(1, w, 0, w2, h2);
+ assert_dimensions(x, y, w2 + w, h2);
+
+ /* y overlap */
+ screenInfo.numScreens = 2;
+ set_screen(0, 0, 0, w2, h2);
+ set_screen(1, 0, h, w2, h2);
+ assert_dimensions(x, y, w2, h2 + h);
+
+ /* negative origin */
+ screenInfo.numScreens = 1;
+ set_screen(0, -w2, -h2, w, h);
+ assert_dimensions(-w2, -h2, w, h);
+
+ /* dualhead negative origin, overlap */
+ screenInfo.numScreens = 2;
+ set_screen(0, -w2, -h2, w2, h2);
+ set_screen(1, -w, -h, w, h);
+ assert_dimensions(-w2, -h2, w2, h2);
+}
+
int main(int argc, char** argv)
{
dix_version_compare();
+ dix_update_desktop_dimensions();
return 0;
}
diff --git a/xorg-server/test/xfree86.c b/xorg-server/test/xfree86.c
index 7012e90c3..448aa915e 100644
--- a/xorg-server/test/xfree86.c
+++ b/xorg-server/test/xfree86.c
@@ -29,6 +29,7 @@
#include "xf86.h"
+#include "xf86Parser.h"
static void
xfree86_option_list_duplicate(void)
@@ -73,9 +74,34 @@ xfree86_option_list_duplicate(void)
assert(a && b);
}
+static void
+xfree86_add_comment(void)
+{
+ char *current = NULL, *comment;
+ char compare[1024] = {0};
+
+ comment = "# foo";
+ current = xf86addComment(current, comment);
+ strcpy(compare, comment);
+ strcat(compare, "\n");
+
+ assert(!strcmp(current, compare));
+
+ /* this used to overflow */
+ strcpy(current, "\n");
+ comment = "foobar\n";
+ current = xf86addComment(current, comment);
+ strcpy(compare, "\n#");
+ strcat(compare, comment);
+ assert(!strcmp(current, compare));
+
+ free(current);
+}
+
int main(int argc, char** argv)
{
xfree86_option_list_duplicate();
+ xfree86_add_comment();
return 0;
}
diff --git a/xorg-server/test/xi2/protocol-common.c b/xorg-server/test/xi2/protocol-common.c
index 56d6bd268..27edfe516 100644
--- a/xorg-server/test/xi2/protocol-common.c
+++ b/xorg-server/test/xi2/protocol-common.c
@@ -108,6 +108,7 @@ TestPointerProc(DeviceIntPtr pDev, int what)
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
pDev->last.valuators[1] = pDev->valuator->axisVal[1];
+ /* protocol-xiquerydevice.c relies on these increment */
SetScrollValuator(pDev, 2, SCROLL_TYPE_VERTICAL, 2.4, SCROLL_FLAG_NONE);
SetScrollValuator(pDev, 3, SCROLL_TYPE_HORIZONTAL, 3.5, SCROLL_FLAG_PREFERRED);
break;
diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c
index ba2d96ad1..dce1c50c4 100644
--- a/xorg-server/test/xi2/protocol-eventconvert.c
+++ b/xorg-server/test/xi2/protocol-eventconvert.c
@@ -389,9 +389,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
{
FP3232 vi, vo;
- vi.integral = trunc(in->valuators.data[i]);
- vi.frac = (in->valuators.data[i] - vi.integral) * (1UL << 32);
-
+ vi = double_to_fp3232(in->valuators.data[i]);
vo = *values;
if (swap)
diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c
index 63d725f28..569aea93a 100644
--- a/xorg-server/test/xi2/protocol-xiquerydevice.c
+++ b/xorg-server/test/xi2/protocol-xiquerydevice.c
@@ -213,9 +213,9 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
}
assert(si->increment.integral == si->number);
- /* FIXME: frac testing with float/FP issues? */
- assert(si->increment.frac > 0.3 * (1UL << 32));
- assert(si->increment.frac < 0.6 * (1UL << 32));
+ /* protocol-common.c sets up increments of 2.4 and 3.5 */
+ assert(si->increment.frac > 0.3 * (1ULL << 32));
+ assert(si->increment.frac < 0.6 * (1ULL << 32));
}
}