[Spice-devel,14/18] server/tests/test_display_streaming: update to create sized frames

Submitted by Yonit Halperin on May 2, 2012, 2:01 p.m.

Details

Message ID 1335967313-24747-14-git-send-email-yhalperi@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Yonit Halperin May 2, 2012, 2:01 p.m.
From: Alon Levy <alevy@redhat.com>

---
 server/tests/test_display_streaming.c |   44 +++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/tests/test_display_streaming.c b/server/tests/test_display_streaming.c
index 1b81d76..b4fe013 100644
--- a/server/tests/test_display_streaming.c
+++ b/server/tests/test_display_streaming.c
@@ -5,14 +5,37 @@ 
  */
 
 #include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <unistd.h>
 #include "test_display_base.h"
 
-int simple_commands[] = {
-    SIMPLE_DRAW,
-    SIMPLE_UPDATE,
-    PATH_PROGRESS,
-    SIMPLE_CREATE_SURFACE,
-    SIMPLE_DESTROY_SURFACE,
+static int sized;
+
+void create_update(Command *command)
+{
+    static int count = 0;
+    CommandDrawSolid *cmd = &command->solid;
+    cmd->surface_id = 0;
+
+    cmd->bbox.left = 0;
+    cmd->bbox.right = test_get_width();
+    cmd->bbox.top = 0;
+    cmd->color = 0xffff00 + ((count * 10) % 256);
+    assert(test_get_height() > 50);
+    cmd->bbox.bottom = test_get_height() - 50;
+    if (count < 20) {
+    } else if (sized && count % 5 == 0) {
+        cmd->bbox.bottom = test_get_height();
+        cmd->color = 0xff;
+    }
+    count++;
+    printf("%d %d\n", count, cmd->bbox.bottom);
+}
+
+static Command commands[] = {
+    {SIMPLE_DRAW_SOLID, create_update},
 };
 
 SpiceCoreInterface *core;
@@ -20,12 +43,19 @@  SpiceServer *server;
 
 int main(int argc, char **argv)
 {
+    int i;
     spice_test_config_parse_args(argc, argv);
+    sized = 0;
+    for (i = 1 ; i < argc; ++i) {
+        if (strcmp(argv[i], "sized") == 0) {
+            sized = 1;
+        }
+    }
     core = basic_event_loop_init();
     server = test_init(core);
     spice_server_set_streaming_video(server, SPICE_STREAM_VIDEO_ALL);
     test_add_display_interface(server);
-    test_set_simple_command_list(simple_commands, COUNT(simple_commands));
+    test_set_command_list(commands, COUNT(commands));
     basic_event_loop_mainloop();
     return 0;
 }