summaryrefslogtreecommitdiffstats
path: root/test/cargstest.c
blob: 2eadce7265a81f6c357c4a435031a021274ada3b (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
#include <rfb/rfb.h>

int main(int argc,char** argv)
{
	int fake_argc=6;
	char* fake_argv[6]={
		"dummy_program","-alwaysshared","-httpport","3002","-nothing","-dontdisconnect"
	};
	rfbScreenInfoPtr screen;
	rfbBool ret=0;

	screen = rfbGetScreen(&fake_argc,fake_argv,1024,768,8,3,1);
#define CHECK(a,b) if(screen->a!=b) { fprintf(stderr,#a " is %d (should be " #b ")\n",screen->a); ret=1; }
	CHECK(width,1024);
	CHECK(height,768);
	CHECK(rfbAlwaysShared,TRUE);
	CHECK(httpPort,3002);
	CHECK(rfbDontDisconnect,TRUE);
	if(fake_argc!=2) {
		fprintf(stderr,"fake_argc is %d (should be 2)\n",fake_argc);
		ret=1;
	}
	if(strcmp(fake_argv[1],"-nothing")) {
		fprintf(stderr,"fake_argv[1] is %s (should be -nothing)\n",fake_argv[1]);
		ret=1;
	}
	return ret;
}