| 1 |
/** |
| 2 |
* FreeDink test suite |
| 3 |
|
| 4 |
* Copyright (C) 2015 Sylvain Beucler |
| 5 |
|
| 6 |
* This file is part of GNU FreeDink |
| 7 |
|
| 8 |
* GNU FreeDink is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License as |
| 10 |
* published by the Free Software Foundation; either version 3 of the |
| 11 |
* License, or (at your option) any later version. |
| 12 |
|
| 13 |
* GNU FreeDink is distributed in the hope that it will be useful, but |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* General Public License for more details. |
| 17 |
|
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see |
| 20 |
* <http://www.gnu.org/licenses/>. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifdef HAVE_CONFIG_H |
| 24 |
#include <config.h> |
| 25 |
#endif |
| 26 |
|
| 27 |
#include "dinkc_console.h" |
| 28 |
#include "SDL.h" |
| 29 |
|
| 30 |
using namespace std; |
| 31 |
|
| 32 |
/* Pleases gnulib's error module */ |
| 33 |
char* program_name = __FILE__; |
| 34 |
|
| 35 |
/* Stub */ |
| 36 |
static string last_line; |
| 37 |
int dinkc_execute_one_liner(char* line) { |
| 38 |
last_line = line; |
| 39 |
return 0; |
| 40 |
} |
| 41 |
|
| 42 |
class TestDinkCConsole : public CxxTest::TestSuite { |
| 43 |
public: |
| 44 |
void setUp() { |
| 45 |
dinkc_console_show(); |
| 46 |
} |
| 47 |
void tearDown() { |
| 48 |
dinkc_console_hide(); |
| 49 |
} |
| 50 |
|
| 51 |
void test_console() { |
| 52 |
TS_ASSERT_EQUALS(dinkc_console_get_cur_line(), ""); |
| 53 |
SDL_KeyboardEvent kev; |
| 54 |
kev.type = SDL_KEYDOWN; |
| 55 |
kev.keysym.scancode = SDL_SCANCODE_RETURN; |
| 56 |
dinkc_console_process_key((SDL_Event*)&kev); |
| 57 |
} |
| 58 |
}; |