summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2012-04-14test_output: run eloop for 5s instead of sleep()David Herrmann1-2/+4
The new eloop implementation allows to run the eloop for a fixed amount of time. Use this instead of sleeping for 5s which would prevent us from catching signals as the eloop blocks them in favor of signalfd. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-14test_output: use new test_include.h headerDavid Herrmann2-12/+108
The test_include.h header now provides the basic initialization that will later be used in all other tests. This allows us to use the same program-parameters that kmscon uses and makes sure everything is initialized properly before we run the tests. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-14test_output: remove signal handlerDavid Herrmann1-11/+0
It will be replaced by the event loop signal handler. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29unicode: use static global symbol tableDavid Herrmann1-12/+4
A symbol table should never be created twice therefore we can make it static and global. We add locks so it is totally thread-safe, too. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24test_terminal: parse command line argumentsDavid Herrmann1-0/+3
Parse command line arguments so the input subsystem recognizes the XKB values. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23vt: fix callback enum typeDavid Herrmann2-2/+6
We should use the enum type instead of plain "int" to be more verbose here. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23Move to new uterm infrastructureDavid Herrmann2-57/+55
This fixes all compositor/output/context/etc. uses and replaces them by the new uterm API. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23test_output: use new uterm/log/etc. subsystemsDavid Herrmann1-68/+94
Convert the test_output test to use the new subsystems. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20eloop: move prefix to "ev_" instead of "kmscon_"David Herrmann4-59/+59
The long "kmscon_" prefix is horrible so move everything to "ev_" now. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20build: implicitly include config.hRan Benita1-2/+0
config.h is meant to be around in all files, as it contains stuff like _GNU_SOURCE, NDEBUG and HAVE_*. Make these definitions available without needing to #include config.h every single time. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04console: remove *_buffer_newline()David Herrmann1-2/+3
This function is no longer needed as we now have proper scrolling functions. This also adjusts the buffer tests to be more appropriate. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-03test_buffer: add margin testsDavid Herrmann1-2/+7
Modify the buffer test to add margin tests. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-02console: move kmscon_console_rotate to *_newlineDavid Herrmann1-2/+2
We do no rotation so rename the function to the more appropriate name kmscon_console_newline. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-29test_buffer: add utf8 state machine testDavid Herrmann1-0/+25
Add trivial test to show how to use the utf8 state machine. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28vte: handle keyboard input (stub)David Herrmann1-27/+9
Make the vte subsystem handle the keyboard input instead of doing this inside of test_terminal. The handling is just a stub function. No actual keys are parsed yet. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28terminal, pty: pass eloop reference on obj creationDavid Herrmann1-5/+3
There is no reason to pass the eloop reference late at terminal/pty open. If we pass it early on object creation we will always have a valid reference and can remove several code paths. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24log: move log_warning to log_warnDavid Herrmann3-3/+3
log_warn is much shorter and we already use log_err instead of log_error so this is more consistent now. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24test_terminal: wait on children to avoid zombiesRan Benita1-6/+62
Unfortunately, there is no clean way I see to hook this up from the pty object. We can (and will) have more than one pty object opened at a time, but the semantics of signalfd make it impossible to deliver each SIGCHLD to its rightful owner without complicating things. [ From what I tested: - If you have two signalfd's listening to the same signal, they will be dispatched in some round-robin manner. - Also, if more than one child exits before we read signalfd (possibly beloging to different terminals), they will be compressed to one event. ] We therefore need to do the reaping from a central location, and need to remember to copy this snippet over to main.c in the future. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24terminal: use new pty objectRan Benita1-1/+11
Add a new terminal_open/terminal_close methods to correspond to the pty ones, and notify when the terminal is closed. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-23test_input: simplify and drop xkbcommon dependencyRan Benita1-15/+4
Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-22font: rewrite font backendDavid Herrmann1-1/+0
We now properly draw fonts with OpenGL. We now use FreeType2 instead of pango to avoid big dependencies. We also add a DejaVu font so we currently don't have to deal with font selection. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-22font: require compositor referenceDavid Herrmann2-6/+6
To avoid cairo dependencies we now take a compositor reference in the font backend so fonts can be drawn with GL textures instead of cairo. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20context: use GL_TRIANGLES instead of GL_QUADSDavid Herrmann1-3/+8
GL_QUADS may actually be not supported on some embedded platforms so we use GL_TRIANGLES. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-20console: use new drawing pipelineDavid Herrmann1-6/+3
Instead of drawing with fixed-function GL pipeline we now use our own shader for texture drawing. This also fixes test_console to no longer depend on GL. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-18console: take reference of compositorDavid Herrmann2-2/+2
To switch to the new drawing subsystem we need a reference to a valid compositor object so we can retrieve the GL context. This also applies to the terminal object. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-18test_output: use new drawing pipelineDavid Herrmann1-18/+13
This converts the output test function to use the new kmscon_context for drawing operations so we no longer depend directly on GL. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-09test_console: fix use-after-freeRan Benita1-0/+1
Here's how it goes: 1. stdin reaches EOF, kmscon_eloop_rm_fd is called on stdin_fd. 2. The fd object is freed, the memory is reused in the meantime. 3. rm_fd is called again in destroy_eloop. 4. con->stdin_fd points to garbage and we get a segmentation fault. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01font: move font handling into new subsystemDavid Herrmann2-2/+15
We use a new font factory which is used to create a new font. It will later also be used to cache fonts and select proper system fonts. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01Adjust all code to use new kmscon_symbol_tDavid Herrmann3-56/+27
This is a big performance boost and reduces the code size quite a bit. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01test_buffer: add kmscon_symbol_t testDavid Herrmann1-0/+34
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31test_terminal: add experimental input supportDavid Herrmann1-0/+39
Add input subsystem to terminal test app. This currently allows to actually "write" to the console. There is still much to do to convert the input to proper data but basic alphanumeric characters work for now. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31input: define our own modifiersRan Benita1-10/+10
Just a direct mapping to X modifiers for now (= Shift, Control, Lock, Mod1-5). This gives us more flexibility to adapt it to our needs in the future. Also we don't have to include libxkbcommon headers just for the modifier definitions. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31input: don't use 0 to signal lack of unicode valueRan Benita1-1/+1
0 is actually a valid unicode value, so instead we use KMSCON_INPUT_INVALID which is not legal unicode. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31input: shuffle headers and includesRan Benita1-0/+3
Just some renames/moving/prefixing to conform to the style of the other files. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31input: use libxkbcommon to convert input eventsRan Benita1-3/+54
This commit introduces a new kmscon_input_event structure which is delivered to the input consumer. The information provided is - The evdev scancode (=physical keyboard key). - The X keysym (a symbol representing what the typist really intended). - The active modifiers (e.g. Shift, Control..) - The unicode (UCS-4) value, when it makes sense. To achieve this we add two dependencies: - libxkbcommon (this entails xproto and kbproto, but shouldn't bring any of big X dependencies) - A function to translate keysyms to unicode values (taken from xlib, copied in-tree). libxkbcommon is not an all-around solution, and requires various degrees of supporting code, depending on how much we wish to support. This commit implements the common, basic uses: - Choosing layouts, variants and options - Switching groups - Switching shift-levels - Setting modifiers Though some stuff is missing. Further information in the comments. test_input.c is updated to use the new input event interface. You can change the layouts in input.c:init_input() and see what works and what doesn't. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31tests: add test for the input subsystemRan Benita1-0/+127
It should: - Capture your keypresses - Announce when a device is added or removed (with --enable-debug) - stop/start capturing on SIGQUIT (Ctrl-\) Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-30terminal: add dummy terminal implementationDavid Herrmann1-0/+197
vte: This adds a dummy VTE subsystem. It will be used to emulate a vt100 terminal based on our console subsystem. terminal: This ties together several subsystems including the output-, the console- and the vte-subsystem. The test_terminal test application can be used to test the terminal. It is supposed to provide a full vt100 implementation which is displayed on all available screens. Most of the functionality here is not implemented yet and only a dummy function. These will be added in later commits. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-30test_console: fix call to kmscon_comp*_useDavid Herrmann1-6/+8
We should activate the GL context on initialization to allow other subsystems to create GL objects. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-30test_output: handle kmscon_comp*_use failureDavid Herrmann1-2/+6
Move the call before the wakeup and also check its return code. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-30vt: fix race-condition in signal handlingDavid Herrmann2-12/+2
Currently, we set up our VT with SIGUSR1/2 signals and after that the user may connect the signal handlers to the eloop. However, if we receive a signal in between, the signal gets lost. Therefore, this simply merges the kmscon_vt_connect_eloop function into kmscon_vt_open as there is no obvious reason to split them. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-26test_console: fix console deinitialization bugDavid Herrmann1-3/+7
We must not destroy the compositor object if there is still a console using the GL context. Otherwise we get a SEGFAULT when calling any gl* function. In future we may need propoper dependencies here. We use reference counts so this should be easy to implement. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-26test_console: copy stdin to console outputDavid Herrmann1-11/+78
Add new fd to eloop that copies stdin to console output. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-26console: calculate width by fontDavid Herrmann1-11/+2
Remove the *_set_res() function entirely. Instead, the *_resize() function now accepts a height argument which is used as quality hint. Internally, we compute the texture width by the selected font plus the given height. This simplifies the API and the internal handling and improves output on non-standard resolutions or with non-standard fonts. Until now it was only optimized for my 16x9 output but 5x4 output was quite garbled. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-21console: support writing to consoleDavid Herrmann1-0/+11
Add kmscon_console_write() to write a character to the current position of the cursor. The cursor is automatically moved to the next cell. Also extend the test_console example to use this new function. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-21console: correctly resize linesDavid Herrmann1-1/+3
When resizing lines we shouldn't drop all information. Instead we only initialize new cells. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-21test_buffer: add buffer playgroundDavid Herrmann1-0/+129
This test app is used to stress test the buffer implementation and finding bugs of the scrollback-buffer rotations etc. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-14vt: add support for automatic VT switchingRan Benita1-0/+14
Add two functions to enter/leave our VT object. This allows to implement to expected behavior of automatically switching to the kmscon when it is running on a new tty, and switching back to the tty we came from when the program finishes. Presumably this behavior will be controlled by a config variable or command line argument later on (like Xorg's -novtswitch). There's a bit of a subtlety in this because of VT_PROCESS. We need permission from ourselves to switch in/out of out VT; this is done when processing SIGUSR[12] in the eloop. We therefore must dispatch the loop at least once after switching out. The usual case is demonstrated in test_vt.c. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-03test_console: Use new eloop and VT subsystemDavid Herrmann1-74/+150
The test_console application now supports VT-switching and monitor-hotplug. New monitors are detected when switching VTs. Full hotplug-support will be added later. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-03Add VT testDavid Herrmann1-0/+104
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-02test_output: Use log APIDavid Herrmann1-12/+12
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>