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