Mercurial > projects > mde
comparison mde/input/Input.d @ 68:3a737e06dc50
Unittests: fixes and changes. Plus some doc changes.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 04 Jul 2008 18:49:16 +0100 |
parents | 66d555da083e |
children | 97e6dce08037 |
comparison
equal
deleted
inserted
replaced
67:108d123238c0 | 68:3a737e06dc50 |
---|---|
347 | 347 |
348 /** Loads all configs, activating the requested id. | 348 /** Loads all configs, activating the requested id. |
349 * | 349 * |
350 * Throws: ConfigLoadException if unable to load any configs or the requested config id wasn't | 350 * Throws: ConfigLoadException if unable to load any configs or the requested config id wasn't |
351 * found. */ | 351 * found. */ |
352 void loadConfig (char[] profile = "Default") { | 352 void loadConfig (char[] file, char[] profile = "Default") { |
353 Config.load("input"); // FIXME: filename | 353 Config.load(file); |
354 Config* c_p = profile in Config.configs; | 354 Config* c_p = profile in Config.configs; |
355 if (c_p) config = *c_p; | 355 if (c_p) config = *c_p; |
356 else { | 356 else { |
357 throw new ConfigLoadException; | 357 throw new ConfigLoadException; |
358 logger.error ("Config profile \""~profile~"\" not found: input won't work unless a valid profile is loaded!"); | 358 logger.error ("Config profile \""~profile~"\" not found: input won't work unless a valid profile is loaded!"); |
543 //END ES Functions | 543 //END ES Functions |
544 //END Event stream functionality | 544 //END Event stream functionality |
545 | 545 |
546 | 546 |
547 /* This unittest covers input.config.Config and input.input.Input for some events of all types. | 547 /* This unittest covers input.config.Config and input.input.Input for some events of all types. |
548 * It is not bullet-proof, and does not cover the steam-functions other than the direct output | 548 * It is not bullet-proof, and does not cover the stream-functions other than the direct output |
549 * ones (largely because these may get added at any time and tested via input tests). | 549 * ones (largely because these may get added at any time and tested via input tests). |
550 * | 550 * |
551 * What it does test: | 551 * What it does test: |
552 * Events of all types. | 552 * Events of all types. |
553 * Callbacks of all types. | 553 * Callbacks of all types. |
555 * | 555 * |
556 * It relies on config loaded from a file (dependant on where input bindings are loaded from; | 556 * It relies on config loaded from a file (dependant on where input bindings are loaded from; |
557 * currently conf/input.mtt). */ | 557 * currently conf/input.mtt). */ |
558 debug (mdeUnitTest) unittest { | 558 debug (mdeUnitTest) unittest { |
559 Input ut = new Input(); | 559 Input ut = new Input(); |
560 ut.loadConfig ("UnitTest"); | 560 ut.loadConfig ("unittest/InputConfig"); |
561 | 561 |
562 int[6] counters; // counters for callbacks | 562 int[6] counters; // counters for callbacks |
563 // Should become: [2,2,0,2,1,1] | 563 // Should become: [2,2,0,2,1,1] |
564 | 564 |
565 //BEGIN Set up some callbacks | 565 //BEGIN Set up some callbacks |