Index: uspace/srv/hid/display/meson.build
===================================================================
--- uspace/srv/hid/display/meson.build	(revision 6af4b4f4b0f0e333036628944619c262e74b3b8d)
+++ uspace/srv/hid/display/meson.build	(revision bef51cf393627fd60142c6b98424b35660187cd1)
@@ -38,5 +38,6 @@
 	'display.c',
 	'window.c',
+	'test/display.c',
 	'test/main.c',
-	'test/display.c',
+	'test/window.c',
 )
Index: uspace/srv/hid/display/test/display.c
===================================================================
--- uspace/srv/hid/display/test/display.c	(revision 6af4b4f4b0f0e333036628944619c262e74b3b8d)
+++ uspace/srv/hid/display/test/display.c	(revision bef51cf393627fd60142c6b98424b35660187cd1)
@@ -33,4 +33,5 @@
 
 #include "../display.h"
+#include "../window.h"
 
 PCUT_INIT;
@@ -39,5 +40,5 @@
 
 /** Display creation and destruction. */
-PCUT_TEST(display_basic)
+PCUT_TEST(display_create_destroy)
 {
 	ds_display_t *disp;
@@ -50,3 +51,30 @@
 }
 
+/** Basic window operation. */
+PCUT_TEST(display_window)
+{
+	ds_display_t *disp;
+	ds_window_t *wnd;
+	ds_window_t *w0, *w1, *w2;
+	errno_t rc;
+
+	rc = ds_display_create(&disp);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_window_create(disp, &wnd);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	w0 = ds_display_first_window(disp);
+	PCUT_ASSERT_EQUALS(w0, wnd);
+
+	w1 = ds_display_next_window(w0);
+	PCUT_ASSERT_NULL(w1);
+
+	w2 = ds_display_find_window(disp, wnd->id);
+	PCUT_ASSERT_EQUALS(w2, wnd);
+
+	ds_window_delete(wnd);
+	ds_display_destroy(disp);
+}
+
 PCUT_EXPORT(display);
Index: uspace/srv/hid/display/test/main.c
===================================================================
--- uspace/srv/hid/display/test/main.c	(revision 6af4b4f4b0f0e333036628944619c262e74b3b8d)
+++ uspace/srv/hid/display/test/main.c	(revision bef51cf393627fd60142c6b98424b35660187cd1)
@@ -32,4 +32,5 @@
 
 PCUT_IMPORT(display);
+PCUT_IMPORT(window);
 
 PCUT_MAIN();
Index: uspace/srv/hid/display/test/window.c
===================================================================
--- uspace/srv/hid/display/test/window.c	(revision bef51cf393627fd60142c6b98424b35660187cd1)
+++ uspace/srv/hid/display/test/window.c	(revision bef51cf393627fd60142c6b98424b35660187cd1)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <pcut/pcut.h>
+#include <stdio.h>
+#include <str.h>
+
+#include "../display.h"
+#include "../window.h"
+
+PCUT_INIT;
+
+PCUT_TEST_SUITE(window);
+
+/** Test ds_window_get_ctx(). */
+PCUT_TEST(window_get_ctx)
+{
+	ds_display_t *disp;
+	ds_window_t *wnd;
+	gfx_context_t *gc;
+	errno_t rc;
+
+	rc = ds_display_create(&disp);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_window_create(disp, &wnd);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	gc = ds_window_get_ctx(wnd);
+	PCUT_ASSERT_NOT_NULL(gc);
+
+	ds_window_delete(wnd);
+	ds_display_destroy(disp);
+}
+
+PCUT_EXPORT(window);
Index: uspace/srv/hid/display/window.c
===================================================================
--- uspace/srv/hid/display/window.c	(revision 6af4b4f4b0f0e333036628944619c262e74b3b8d)
+++ uspace/srv/hid/display/window.c	(revision bef51cf393627fd60142c6b98424b35660187cd1)
@@ -131,4 +131,6 @@
 	errno_t rc;
 
+	ds_display_remove_window(wnd);
+
 	rc = gfx_context_delete(wnd->gc);
 	if (rc != EOK)
