summaryrefslogtreecommitdiff
path: root/xc/test/xsuite/xtest/tset/CH02/dsplyhght/dsplyhght.m
blob: f989e89f8c5a9b11e7428eeb16ea05eeaf12e40f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 1990, 1991 by the Massachusetts Institute of Technology and
 * UniSoft Group Limited.
 * 
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation, and that the names of MIT and UniSoft not be
 * used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.  MIT and UniSoft
 * make no representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 * $XConsortium$
 */
>>SET   macro
>>TITLE XDisplayHeight CH02
int
XDisplayHeight(display, screen_number)
Display	*display = Dsp;
int	screen_number = DefaultScreen(Dsp);
>>ASSERTION Good A
A call to xname returns the height in pixels of the screen
.A screen_number .
>>STRATEGY
Obtain the height of the root window using XGetWindowAttributes.
Obtain the pixel height of the screen using xname.
Verify that the heights are the same.
>>CODE
XWindowAttributes	atts;
int			height;

	if(XGetWindowAttributes(display, RootWindow(display, screen_number), &atts) == 0) {
		report("XGetWindowAttributes() returned zero.");
		FAIL;
	} else
		CHECK;

	height = XCALL;

	if(height != atts.height) {
		report("%s() returned %d instead of %d.", TestName, height, atts.height);
		FAIL;
	} else
		CHECK;

	CHECKPASS(2);