1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 typedef unsigned char Uint8;
11 typedef unsigned short Uint16;
24 typedef struct SDL_keysym {
31 typedef struct SDL_KeyboardEvent {
38 void makeEvent(SDL_KeyboardEvent *event) {
42 p = (unsigned char*)event;
43 for (i=0; i<sizeof *event; i++) {
48 int same(SDL_KeyboardEvent* e, Uint8 typ, Uint8 which, Uint8 state, Uint8 scan, SDLKey sym, SDLMod mod, Uint16 uni) {
49 return e->typ == typ && e->which == which && e->state == state && e->keysym.scancode == scan && e->keysym.sym == sym && e->keysym.mod == mod && e->keysym.unicode == uni;
52 void cTest(SDL_KeyboardEvent *event) {
53 printf("C: %#x %#x %#x %#x %#x %#x %#x\n", event->typ, event->which, event->state,
54 event->keysym.scancode, event->keysym.sym, event->keysym.mod, event->keysym.unicode);
65 func testAlign(t
*testing
.T
) {
66 var evt C
.SDL_KeyboardEvent
68 if C
.same(&evt
, evt
.typ
, evt
.which
, evt
.state
, evt
.keysym
.scancode
, evt
.keysym
.sym
, evt
.keysym
.mod
, evt
.keysym
.unicode
) == 0 {
69 t
.Error("*** bad alignment")
71 t
.Errorf("Go: %#x %#x %#x %#x %#x %#x %#x\n",
72 evt
.typ
, evt
.which
, evt
.state
, evt
.keysym
.scancode
,
73 evt
.keysym
.sym
, evt
.keysym
.mod
, evt
.keysym
.unicode
)