flexcat 2.15 is picky.
[AROS.git] / test / intuition / drawinfoattr.c
blobb258c1d8dd521d34dfff4410cab3a02a3ca48bea
1 #include <intuition/diattr.h>
2 #include <intuition/iobsolete.h>
3 #include <proto/intuition.h>
5 #include <stdio.h>
7 struct RefResults
9 IPTR val;
10 IPTR error;
13 static UWORD test_pens[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
15 static struct DrawInfo test_di =
19 test_pens,
20 (APTR)(IPTR)0xC0DEBAD1,
22 {22, 22},
23 DRIF_NEWLOOK,
24 (APTR)(IPTR)0xC0DEBAD2,
25 (APTR)(IPTR)0xC0DEBAD3
28 static void TestAttr(ULONG id, struct DrawInfo *dinfo)
30 IPTR err = 0;
31 IPTR val = GetDrawInfoAttr(dinfo, id, &err);
33 printf("AttrID 0x%08lX Value %08llX\tError: %lld\n", (unsigned long)id, (unsigned long long)val, (long long)err);
36 static void TestAllAttrs(struct DrawInfo *dinfo)
38 ULONG attr;
40 /* All colors, including invalid one */
41 for (attr = DRIPEN_DETAIL; attr <= DRIPEN_NUMDRIPENS; attr++)
43 TestAttr(GDIA_Color | attr, dinfo);
46 /* Now all pens */
47 for (attr = DRIPEN_DETAIL; attr <= DRIPEN_NUMDRIPENS; attr++)
49 TestAttr(GDIA_Pen | attr, dinfo);
52 /* The rest of attributes, including invalid attr */
53 for (attr = GDIA_Version; attr <= 0x00C00000; attr += 0x00100000)
55 TestAttr(attr, dinfo);
59 int main(void)
61 struct Screen *scr = LockPubScreen(NULL);
62 struct DrawInfo *di;
64 if (!scr)
66 printf("Failed to lock default public screen!\n");
67 return 20;
70 di = GetScreenDrawInfo(scr);
71 printf("Checking attributes for DrawInfo %p public screen %p\n", di, scr);
72 TestAllAttrs(di);
74 #ifdef __MORPHOS__
75 /* On MorphOS the function simply fails if meets non-own dri_Version */
76 test_di.dri_Version = di->dri_Version;
77 #endif
78 printf("Checking test DrawInfo\n");
79 TestAllAttrs(&test_di);
81 UnlockPubScreen(NULL, scr);
82 printf("Checking default values...\n");
83 TestAllAttrs(NULL);
85 return 0;