start service tasks separately in-case platforms need to perform additional set-up...
[AROS.git] / test / intuition / drawinfoattr.c
blob683d2a3ba06f643b0d823d77de3612bf36febf4f
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <intuition/diattr.h>
7 #include <intuition/iobsolete.h>
8 #include <proto/intuition.h>
10 #include <stdio.h>
12 struct RefResults
14 IPTR val;
15 IPTR error;
18 static UWORD test_pens[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
20 static struct DrawInfo test_di =
24 test_pens,
25 (APTR)(IPTR)0xC0DEBAD1,
27 {22, 22},
28 DRIF_NEWLOOK,
29 (APTR)(IPTR)0xC0DEBAD2,
30 (APTR)(IPTR)0xC0DEBAD3
33 static void TestAttr(ULONG id, struct DrawInfo *dinfo)
35 IPTR err = 0;
36 IPTR val = GetDrawInfoAttr(dinfo, id, &err);
38 printf("AttrID 0x%08lX Value %08llX\tError: %lld\n", (unsigned long)id, (unsigned long long)val, (long long)err);
41 static void TestAllAttrs(struct DrawInfo *dinfo)
43 ULONG attr;
45 /* All colors, including invalid one */
46 for (attr = DRIPEN_DETAIL; attr <= DRIPEN_NUMDRIPENS; attr++)
48 TestAttr(GDIA_Color | attr, dinfo);
51 /* Now all pens */
52 for (attr = DRIPEN_DETAIL; attr <= DRIPEN_NUMDRIPENS; attr++)
54 TestAttr(GDIA_Pen | attr, dinfo);
57 /* The rest of attributes, including invalid attr */
58 for (attr = GDIA_Version; attr <= 0x00C00000; attr += 0x00100000)
60 TestAttr(attr, dinfo);
64 int main(void)
66 struct Screen *scr = LockPubScreen(NULL);
67 struct DrawInfo *di;
69 if (!scr)
71 printf("Failed to lock default public screen!\n");
72 return 20;
75 di = GetScreenDrawInfo(scr);
76 printf("Checking attributes for DrawInfo %p public screen %p\n", di, scr);
77 TestAllAttrs(di);
79 #ifdef __MORPHOS__
80 /* On MorphOS the function simply fails if meets non-own dri_Version */
81 test_di.dri_Version = di->dri_Version;
82 #endif
83 printf("Checking test DrawInfo\n");
84 TestAllAttrs(&test_di);
86 UnlockPubScreen(NULL, scr);
87 printf("Checking default values...\n");
88 TestAllAttrs(NULL);
90 return 0;