diff options
author | marha <marha@users.sourceforge.net> | 2012-05-02 09:01:55 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-05-02 09:01:55 +0200 |
commit | 3d353f31ac1671d1b39c09b1f8d82c8811d3edd6 (patch) | |
tree | ce19dbcec75ce7e87547f6f9b3495888aaea0966 /xorg-server/test | |
parent | b2a0f04a2984b290c1224fc1b1883d08b01a6231 (diff) | |
parent | e67b35e7a899da5805fcce3d390cb10ebcaffe91 (diff) | |
download | vcxsrv-3d353f31ac1671d1b39c09b1f8d82c8811d3edd6.tar.gz vcxsrv-3d353f31ac1671d1b39c09b1f8d82c8811d3edd6.tar.bz2 vcxsrv-3d353f31ac1671d1b39c09b1f8d82c8811d3edd6.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/os/connection.c
Diffstat (limited to 'xorg-server/test')
-rw-r--r-- | xorg-server/test/Makefile.am | 2 | ||||
-rw-r--r-- | xorg-server/test/xi2/protocol-xiqueryversion.c | 113 |
2 files changed, 114 insertions, 1 deletions
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am index 85823977b..b2a53aa64 100644 --- a/xorg-server/test/Makefile.am +++ b/xorg-server/test/Makefile.am @@ -36,7 +36,7 @@ misc_LDADD=$(TEST_LDADD) fixes_LDADD=$(TEST_LDADD) xfree86_LDADD=$(TEST_LDADD) touch_LDADD=$(TEST_LDADD) -hashtabletest_LDADD=$(TEST_LDADD) ../Xext/hashtable.c +hashtabletest_LDADD=$(TEST_LDADD) $(top_srcdir)/Xext/hashtable.c libxservertest_la_LIBADD = $(XSERVER_LIBS) if XORG diff --git a/xorg-server/test/xi2/protocol-xiqueryversion.c b/xorg-server/test/xi2/protocol-xiqueryversion.c index 2552307f2..1347e866c 100644 --- a/xorg-server/test/xi2/protocol-xiqueryversion.c +++ b/xorg-server/test/xi2/protocol-xiqueryversion.c @@ -54,6 +54,8 @@ struct test_data { int minor_client; int major_server; int minor_server; + int major_cached; + int minor_cached; }; static void @@ -82,6 +84,24 @@ reply_XIQueryVersion(ClientPtr client, int len, char *data, void *userdata) assert((sver > cver) ? ver == cver : ver == sver); } +static void +reply_XIQueryVersion_multiple(ClientPtr client, int len, char *data, void *userdata) +{ + xXIQueryVersionReply *rep = (xXIQueryVersionReply *) data; + struct test_data *versions = (struct test_data *) userdata; + + reply_check_defaults(rep, len, XIQueryVersion); + assert(rep->length == 0); + + if (versions->major_cached == -1) { + versions->major_cached = rep->major_version; + versions->minor_cached = rep->minor_version; + } + + assert(versions->major_cached == rep->major_version); + assert(versions->minor_cached == rep->minor_version); +} + /** * Run a single test with server version smaj.smin and client * version cmaj.cmin. Verify that return code is equal to 'error'. @@ -173,12 +193,105 @@ test_XIQueryVersion(void) reply_handler = NULL; } + +static void +test_XIQueryVersion_multiple(void) +{ + xXIQueryVersionReq request; + ClientRec client; + struct test_data versions; + int rc; + + request_init(&request, XIQueryVersion); + client = init_client(request.length, &request); + + /* Change the server to support 2.2 */ + XIVersion.major_version = 2; + XIVersion.minor_version = 2; + + reply_handler = reply_XIQueryVersion_multiple; + userdata = (void *) &versions; + + /* run 1 */ + versions.major_cached = -1; + versions.minor_cached = -1; + + /* client is lower than server, noncached */ + request.major_version = 2; + request.minor_version = 1; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + /* client is higher than server, cached */ + request.major_version = 2; + request.minor_version = 3; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + /* client is equal, cached */ + request.major_version = 2; + request.minor_version = 2; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + /* client is low than cached */ + request.major_version = 2; + request.minor_version = 0; + rc = ProcXIQueryVersion(&client); + assert(rc == BadValue); + + /* run 2 */ + client = init_client(request.length, &request); + XIVersion.major_version = 2; + XIVersion.minor_version = 2; + versions.major_cached = -1; + versions.minor_cached = -1; + + request.major_version = 2; + request.minor_version = 2; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + request.major_version = 2; + request.minor_version = 3; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + request.major_version = 2; + request.minor_version = 1; + rc = ProcXIQueryVersion(&client); + assert(rc == BadValue); + + /* run 3 */ + client = init_client(request.length, &request); + XIVersion.major_version = 2; + XIVersion.minor_version = 2; + versions.major_cached = -1; + versions.minor_cached = -1; + + request.major_version = 2; + request.minor_version = 3; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + request.major_version = 2; + request.minor_version = 2; + rc = ProcXIQueryVersion(&client); + assert(rc == Success); + + request.major_version = 2; + request.minor_version = 1; + rc = ProcXIQueryVersion(&client); + assert(rc == BadValue); +} + int main(int argc, char **argv) { init_simple(); test_XIQueryVersion(); + test_XIQueryVersion_multiple(); return 0; } |