Changeset 40:ec5dde8a6ff6 in xplra for test/basicctest.c


Ignore:
Timestamp:
02/14/13 18:21:47 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented the client support for the new commands and updated the basic test programs with tests showing messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/basicctest.c

    r36 r40  
    3333#include <stdio.h>
    3434#include <string.h>
     35
     36#ifdef _WIN32
     37#include <windows.h>
     38#else
     39#include <unistd.h>
     40#endif
     41
     42//------------------------------------------------------------------------------
     43
     44#ifdef _WIN32
     45void _sleep(int ms)
     46{
     47    Sleep(ms);
     48}
     49#else
     50void _sleep(int ms)
     51{
     52    usleep(ms*1000);
     53}
     54#endif
     55
    3556
    3657//------------------------------------------------------------------------------
     
    7495    }
    7596
     97    printf("Showing a message...\n");
     98    if (xplra_show_message(connectionID, "[basictest] Starting tests", 5.0)<0) goto error;
     99    printf("\n");
     100
    76101    printf("Querying the versions...\n");
    77102    if (xplra_get_versions(connectionID, &xplaneVersion,
     
    341366    printf("The tail number is: '%s'\n\n", (char*)tailNum);
    342367
     368    printf("Preparing for the message tests, sleeping for 5 seconds...\n");
     369    _sleep(5*1000);
     370
     371    printf("Showing a message for 10 seconds...\n");
     372    if (xplra_show_message(connectionID, "[basictest] this message appears for 10 seconds", 10.0)<0) {
     373        goto error;
     374    }
     375
     376    printf("Sleeping for 3 seconds...\n");
     377    _sleep(3*1000);
     378
     379    printf("Showing another message interrupting the previous one for 3 seconds");
     380    if (xplra_show_message(connectionID, "[basictest] but this message interrupts it, and is displayed for 3 seconds", 3.0)<0) {
     381        goto error;
     382    }
     383
     384    printf("Sleeping for 5 seconds...\n");
     385    _sleep(5*1000);
     386    if (xplra_show_message(connectionID, "[basictest] and the tests come to an end!", 5.0)<0) {
     387        goto error;
     388    }
     389
    343390    goto cleanup;
    344391error:
Note: See TracChangeset for help on using the changeset viewer.