1/**
2 * Test that m4 config rewriting works.
3 */
4
5#include "ctwm.h"
6
7#include <stdio.h>
8
9#include "ctwm_main.h"
10#include "ctwm_test.h"
11#include "screen.h"
12
13
14/**
15 * Callback: after the config file gets parsed, make sure we got the info
16 * we expected out of it.
17 */
18static int
19check_wsm_geom(void)
20{
21	const char *expected_geom = "300x100+10+10";
22	const int expected_columns = 2;
23
24	// Guard against things that shouldn't happen
25	if(Scr == NULL) {
26		fprintf(stderr, "BUG: Scr == NULL\n");
27		return 1;
28	}
29	if(Scr->workSpaceMgr.geometry == NULL) {
30		fprintf(stderr, "BUG: Scr->workSpaceMgr.geometry == NULL\n");
31		return 1;
32	}
33
34
35	// Now check that we got the expected result
36	if(strcmp(Scr->workSpaceMgr.geometry, expected_geom) != 0) {
37		fprintf(stderr, "Got '%s' instead of expected '%s' geometry.\n",
38		        Scr->workSpaceMgr.geometry, expected_geom);
39		return 1;
40	}
41
42	if(Scr->workSpaceMgr.columns != expected_columns) {
43		fprintf(stderr, "Got '%d' instead of expected '%d' columns.\n",
44		        Scr->workSpaceMgr.columns, expected_columns);
45		return 1;
46	}
47
48
49	// OK, everything was good.
50	fprintf(stdout, "OK\n");
51	return 0;
52}
53
54
55
56/*
57 * Connect up our callback and kick off ctwm.
58 *
59 * XXX We should probably have the various necessary args hardcoded into
60 * here instead of relying on our caller, but this is a workable first
61 * step.
62 */
63int
64main(int argc, char *argv[])
65{
66	// Connect up
67	TEST_POSTPARSE(check_wsm_geom);
68
69	return ctwm_main(argc, argv);
70}
71