Commit f546e278 authored by Jeremy White's avatar Jeremy White

Add a new test for a 4k screen, which currently fails.

parent 99ad9b89
......@@ -35,6 +35,9 @@ int main(int argc, char *argv[])
g_test_add("/x11spice/resize", xdummy_t, "resize", start_server, test_resize, stop_server);
g_test_add("/x11spice/tallscreen", xdummy_t, "tallscreen", start_server, test_tallscreen,
stop_server);
g_test_add("/x11spice/x11perf1", xdummy_t, "x11perf1", start_server, test_script, stop_server);
#if defined(SPICEDUMMY)
......
......@@ -125,7 +125,7 @@ static void check_screenshot(test_t *test, x11spice_server_t *spice_server, xdum
void test_basic(xdummy_t *xdummy, gconstpointer user_data)
{
test_t test;
test_t test = { };
x11spice_server_t server;
int rc;
char buf[4096];
......@@ -152,7 +152,7 @@ void test_basic(xdummy_t *xdummy, gconstpointer user_data)
void test_resize(xdummy_t *xdummy, gconstpointer user_data)
{
test_t test;
test_t test = { };
x11spice_server_t server;
int rc;
char buf[4096];
......@@ -185,6 +185,37 @@ void test_resize(xdummy_t *xdummy, gconstpointer user_data)
test_common_stop(&test, &server);
}
void test_tallscreen(xdummy_t *xdummy, gconstpointer user_data)
{
test_t test = { };
x11spice_server_t server;
int rc;
char buf[4096];
if (check_binary("xrandr", xdummy->display) || check_binary("spicy-screenshot", NULL))
return;
test.never_trust_damage = 1;
rc = test_common_start(&test, &server, xdummy, user_data);
if (rc)
return;
snprintf(buf, sizeof(buf), "xrandr --display :%s -s 3840x2160", xdummy->display);
system(buf);
snprintf(buf, sizeof(buf), ":%s", xdummy->display);
if (xcb_draw_grid(buf)) {
g_warning("Could not draw the grid");
g_test_fail();
}
else {
snprintf(buf, sizeof(buf), "%s/expected.grid.3840x2160.ppm", PATH_TO_TEST_SRC);
check_screenshot(&test, &server, xdummy, buf);
}
test_common_stop(&test, &server);
}
/*
** The 'script' type test is a special case.
** It is set up to allow us to run any shell script we like.
......@@ -196,7 +227,7 @@ void test_resize(xdummy_t *xdummy, gconstpointer user_data)
*/
void test_script(xdummy_t *xdummy, gconstpointer user_data)
{
test_t test;
test_t test = { };
x11spice_server_t server;
xdummy_t client_server;
char buf[4096];
......@@ -206,7 +237,7 @@ void test_script(xdummy_t *xdummy, gconstpointer user_data)
gchar *script_out;
gchar *script_dir;
snprintf(buf, sizeof(buf), "%s/%s", PATH_TO_TEST_SRC, user_data);
snprintf(buf, sizeof(buf), "%s/%s", PATH_TO_TEST_SRC, (char *) user_data);
if (access(buf, X_OK | R_OK)) {
g_warning("Could not find client script [%s]", (char *) user_data);
g_test_fail();
......
......@@ -34,6 +34,7 @@ typedef struct
xdummy_t *xserver;
const gchar *logfile;
const gchar *name;
int never_trust_damage;
} test_t;
......@@ -42,6 +43,7 @@ typedef struct
**--------------------------------------------------------------------------*/
void test_basic(xdummy_t *server, gconstpointer user_data);
void test_resize(xdummy_t *server, gconstpointer user_data);
void test_tallscreen(xdummy_t *server, gconstpointer user_data);
void test_script(xdummy_t *xdummy, gconstpointer user_data);
#endif
......@@ -117,6 +117,8 @@ int x11spice_start(x11spice_server_t *server, test_t *test)
char *config_data = "[spice]\n"
"disable-ticketing=true\n";
fwrite(config_data, 1, strlen(config_data), fp);
if (test->never_trust_damage)
fprintf(fp, "trust-damage=never\n");
fclose(fp);
}
......
......@@ -67,7 +67,7 @@ static void write_xorg_conf(FILE * fp, xdummy_t *server)
" Identifier \"dummy_monitor\"\n"
" VendorName \"Unknown\"\n"
" ModelName \"Unknown\"\n"
" HorizSync 30.0 - 130.0\n"
" HorizSync 0.0 - 260.0\n"
" VertRefresh 50.0 - 250.0\n"
" Option \"DPMS\"\n"
" Option \"ReducedBlanking\"\n"
......@@ -236,6 +236,12 @@ static void configure_xorg_parameters(xdummy_t *server, gconstpointer user_data)
server->vmode = "1920 1080";
}
if (strcmp(user_data, "tallscreen") == 0) {
server->desired_vram = ((3840 * 2160 * 4) + 1023) / 1024;
server->modes = "\"3840x2160\"";
server->vmode = "3840 2160";
}
if (strlen(user_data) > 7 && memcmp(user_data, "client_", 7) == 0) {
server->desired_vram = ((1280 * 1024 * 4) + 1023) / 1024;
server->modes = "\"1280x1024\"";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment