18 Commits

Author SHA1 Message Date
Paul Donohue
0a997601ab src: Unify hotkey setup from command line and config file
This is mostly just code de-duplication and cleanup.  The only
functional change is that the case-sensitive accel support from the
command-line hotkey handling now also applies to the config file.

Signed-off-by: Paul Donohue <git@PaulSD.com>
2021-07-30 10:03:02 +00:00
Paul Donohue
64a2ecdfe3 tests: Disable smartcard hotkey test to work around CI issue
The next commit fixes a bug which was causing
gtk_application_get_accels_for_action() in
virt_viewer_update_smartcard_accels() to incorrectly return nothing.
Now that it is correctly working,
gtk_application_get_accels_for_action() is internally trying to call
gdk_keymap_get_for_display(), which fails if there is no available X11
display.  This causes the CI pipeline to fail since the CI pipeline
doesn't have an X11 display.

To work around this, disable the smartcard hotkey test.

Signed-off-by: Paul Donohue <git@PaulSD.com>
2021-07-30 10:03:02 +00:00
Daniel P. Berrangé
942fc8c6fb src: remove G_BEGIN_DECLS / G_END_DECLS
None of our header files are installed for public use, so these macros
are not required.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-17 11:35:32 +00:00
Daniel P. Berrangé
396f31cb4b tests: convert VirtViewerTest to G_DECLARE_FINAL_TYPE
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-17 11:35:32 +00:00
Daniel P. Berrangé
7a71409028 build: bump min required glib to 2.48
All our targetted distros have this vintage glib letting us remove some
compat code, and introduce future use of new features.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-17 11:35:32 +00:00
Daniel P. Berrangé
1f814df294 build: remove all traces of autotools build recipes
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-25 16:02:48 +00:00
Daniel P. Berrangé
b2c072cf0b build: introduce meson build recipes
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-25 16:02:48 +00:00
Daniel P. Berrangé
45dd26ece2 src: add missing COMMON_CFLAGS to libvirt_viewer_util.la
This ensures that G_LOG_DOMAIN is used in all places, and in turns
highlights a bug in the test suite.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-22 16:14:40 +00:00
Daniel P. Berrangé
041857e677 tests: ensure compiler knows the argv[0] is non-NULL
../tests/redirect-test.c
/usr/i686-w64-mingw32/sys-root/mingw/include/winbase.h: In function 'WinMain':
../../tests/redirect-test.c:318:5: error: '%s' directive argument is null [-Werror=format-overflow=]
  318 |     fprintf(log_f, "argc %d argv[0] %s \n", argc, argv[0]);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../tests/redirect-test.c:318:5: error: '%s' directive argument is null [-Werror=format-overflow=]

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-22 16:14:40 +00:00
Uri Lublin
8de1e49136 tests: hotkeys: add zoom hotkeys
Signed-off-by: Uri Lublin <uril@redhat.com>
2021-01-05 11:06:19 +02:00
Jonathon Jongsma
95faf12283 tests: improvements to monitor-mapping test
Add some tests that specify different numbers of client monitors to
ensure that the parsing handles those situations correctly.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-04-11 15:20:14 -05:00
Pavel Grunt
cb4ec1fc80 monitor-alignment: Do not crash on NULL display
Since commit 01b66ef88bc142d6716b40b1e384e94a2629a99f virt-viewer
does not crash on connection to a guest using an invalid display
configuration (eg. Cirrus & QXL vga). That commit allowed existence
of NULL display, however the code handling monitors alignment does
not expect this and crashes when virt-viewer is shifting/aligning
its windows.

Avoid crashing by returning early on NULL display.

 #0  0x0000000000411d0a in displays_cmp (p1=p1@entry=0xbad940, p2=p2@entry=0xbad944, user_data=user_data@entry=0x8eb180) at virt-viewer-util.c:544
 #1  0x00007ffff3f16ac5 in msort_with_tmp (p=0x7fffffffd670, b=0xbad940, n=2) at gqsort.c:93
 #2  0x00007ffff3f16ded in msort_r (b=b@entry=0xbad940, n=n@entry=2, s=s@entry=4, cmp=cmp@entry=0x411ce0 <displays_cmp>, arg=arg@entry=0x8eb180) at gqsort.c:278
 #3  0x00007ffff3f16e78 in g_qsort_with_data (pbase=pbase@entry=0xbad940, total_elems=total_elems@entry=2, size=size@entry=4, compare_func=compare_func@entry=0x411ce0 <displays_cmp>, user_data=user_data@entry=0x8eb180) at gqsort.c:303
 #4  0x000000000041277c in virt_viewer_align_monitors_linear (displays=displays@entry=0x8eb180 = {...}) at virt-viewer-util.c:586
 #5  0x000000000041a92d in virt_viewer_session_on_monitor_geometry_changed (self=0x8f38a0 [VirtViewerSessionSpice], display=<optimized out>) at virt-viewer-session.c:373
 #6  0x00007ffff4415908 in g_closure_invoke (closure=0x9306c0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fffffffd960, invocation_hint=invocation_hint@entry=0x7fffffffd900)  at gclosure.c:801
 #7  0x00007ffff4427a1d in signal_emit_unlocked_R (node=node@entry=0x668f80, detail=detail@entry=1551, instance=instance@entry=0x930440, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffd960) at gsignal.c:3627
 #8  0x00007ffff442fab1 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffdaf0) at gsignal.c:3383
 #9  0x00007ffff442fd9f in <emit signal notify:agent-connected on instance 0x930440 [SpiceMainChannel]> (instance=instance@entry=0x930440, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3439
 #10 0x00007ffff4419fd4 in g_object_dispatch_properties_changed (object=0x930440 [SpiceMainChannel], n_pspecs=<optimized out>, pspecs=<optimized out> at gobject.c:1061
 #11 0x00007ffff441c4f9 in g_object_notify (pspec=<optimized out>, object=0x930440 [SpiceMainChannel]) at gobject.c:1155
 #12 0x00007ffff441c4f9 in g_object_notify (object=0x930440 [SpiceMainChannel], property_name=<optimized out>) at gobject.c:1202
 #13 0x00007ffff5a63dd0 in notify_main_context (opaque=0x7fffd6fde990) at gio-coroutine.c:240
 #14 0x00007ffff3f07d7a in g_main_context_dispatch (context=0x68da40) at gmain.c:3152
 #15 0x00007ffff3f07d7a in g_main_context_dispatch (context=context@entry=0x68da40) at gmain.c:3767
 #16 0x00007ffff3f080b8 in g_main_context_iterate (context=0x68da40, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838
 #17 0x00007ffff3f0838a in g_main_loop_run (loop=0x710de0) at gmain.c:4032
 #18 0x00007ffff5f53045 in gtk_main () at gtkmain.c:1207
 #19 0x0000000000411a22 in main (argc=1, argv=0x7fffffffdfa8)

Resolves: rhbz#1250820

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-20 17:08:28 +02:00
Pavel Grunt
99d81d2fde Add tests for monitor alignment
Related: rhbz#1250820

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-20 17:08:22 +02:00
Michal Privoznik
9f3029291d tests: Fix VPATH build
So test-hotkeys include virt-viewer-app.h which includes
virt-viewer-window.h which includes virt-viewer-display.h which
in turn wants to include virt-viewer-enums.h. But, the enums
header file is generated at build time into builddir not srcdir.
Therefore it may happen if the two are distinct that compiler
fails to find the enums file:

In file included from ../../src/virt-viewer-window.h:29:0,
                 from ../../src/virt-viewer-app.h:28,
                 from ../../tests/test-hotkeys.c:27:
../../src/virt-viewer-display.h:28:31: fatal error: virt-viewer-enums.h: No such file or directory
 #include "virt-viewer-enums.h"
                               ^
compilation terminated.

The fix is to include builddir into paths where header files are
looked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-04 20:20:45 +02:00
Pavel Grunt
ffa460b8c6 app: Check validity of hotkey
The hotkey is valid if it has a valid value. The value is valid if it is
not empty and is successfully parsed by gtk_accelerator_parse().

These hotkeys formats are considered invalid:
 "key" - missing value
 "key=" - missing value
 "key=abcd" - value cannot be parsed by gtk_accelerator_parse()

Resolves: rhbz#1339572

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-02 11:04:02 +02:00
Pavel Grunt
9a3041eb00 tests: Add hotkeys test
Check if expected g_warning messages are logged.

Related: rhbz#1339572

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-02 10:59:25 +02:00
Frediano Ziglio
e732fa08c8 Add a program to test redirection on Windows
This program attempt multiple redirection combination:
- passing handles using either CreateProcess or SetStdHandle;
- having a console or not;
- redirection stdout/stderr yes or not.

Worth to mention that for running this test program the user will need
either a native MingW or Wine (with .exe executables enabled in Linux
binfmt).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-05-04 11:16:05 +02:00
Pavel Grunt
2736081940 Move tests under /tests directory
Keep tests separated from the code
2016-03-14 16:36:37 +01:00