summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authordscho <dscho>2004-06-07 08:31:57 +0000
committerdscho <dscho>2004-06-07 08:31:57 +0000
commit2b8c2a5c3a71364e402b4df334a6f5aff5ed77a9 (patch)
tree66e59b58f919f5848780d5c7d6c954160e289cff /test
parent98e4f89569587c143a56e4dcf8162a035efc361e (diff)
downloadlibvncserver-2b8c2a5c3a71364e402b4df334a6f5aff5ed77a9.zip
libvncserver-2b8c2a5c3a71364e402b4df334a6f5aff5ed77a9.tar.gz
add client_examples/, add SDLvncviewer, libvncclient API changes, suppress automake CFLAGS nagging
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am11
-rwxr-xr-xtest/blooptest.c2
-rw-r--r--test/copyrecttest.c50
-rw-r--r--test/tight-1.c2
4 files changed, 62 insertions, 3 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 1ca7941..33839d5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,13 @@
-CFLAGS=-I.. -g -Wall
+DEFINES=-I.. -g -Wall
+
+if HAVE_LIBPTHREAD
+BACKGROUND_TEST=blooptest
+endif
+
+copyrecttest_LDADD=$(LDADD) -lm
+
+noinst_PROGRAMS=tight-1 cargstest copyrecttest $(BACKGROUND_TEST)
-noinst_PROGRAMS=tight-1 cargstest
LDADD = ../libvncserver/libvncserver.a ../libvncclient/libvncclient.a
diff --git a/test/blooptest.c b/test/blooptest.c
new file mode 100755
index 0000000..a2661e8
--- /dev/null
+++ b/test/blooptest.c
@@ -0,0 +1,2 @@
+#define BACKGROUND_LOOP_TEST
+#include "../examples/example.c"
diff --git a/test/copyrecttest.c b/test/copyrecttest.c
new file mode 100644
index 0000000..ff278b4
--- /dev/null
+++ b/test/copyrecttest.c
@@ -0,0 +1,50 @@
+#include <rfb/rfb.h>
+#include <math.h>
+
+void initBackground(rfbScreenInfoPtr server)
+{
+ unsigned int i,j;
+
+ for(i=0;i<server->width;i++)
+ for(j=0;j<server->height;j++) {
+ server->frameBuffer[(j*server->width+i)*4+0]=i&0xff;
+ server->frameBuffer[(j*server->width+i)*4+1]=j&0xff;
+ server->frameBuffer[(j*server->width+i)*4+2]=(i*j)&0xff;
+ }
+}
+
+int main(int argc,char** argv)
+{
+ int width=400,height=300,w=20,x,y;
+ double r,phi;
+
+ rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,width,height,8,3,4);
+ server->frameBuffer=(char*)malloc(width*height*4);
+ initBackground(server);
+ server->rfbDeferUpdateTime=0;
+ rfbInitServer(server);
+
+ r=0;
+ while(1) {
+ if(r<=0) {
+ initBackground(server);
+ rfbMarkRectAsModified(server,0,0,width,height);
+ r=0.43;
+ phi=0;
+ } else {
+ r-=0.0001;
+ phi+=0.02;
+ if(phi>2*M_PI)
+ phi-=2*M_PI;
+ }
+ x=width*(0.5+cos(phi)*r);
+ y=height*(0.5+sin(phi)*r);
+ if(x>=0 && y>=0 && x+w<=width && y+w<=height) {
+ unsigned int dx=width*0.5*(1-cos(phi)*r)-x,
+ dy=height*0.5*(1-sin(phi)*r)-y;
+ rfbDoCopyRect(server,x,y,x+w,y+w,-dx,-dy);
+ }
+ rfbProcessEvents(server,50000);
+ }
+ return(0);
+}
diff --git a/test/tight-1.c b/test/tight-1.c
index 987d481..fa22ea7 100644
--- a/test/tight-1.c
+++ b/test/tight-1.c
@@ -8,7 +8,7 @@ int main(int argc,char** argv)
time_t t=time(0);
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
- rfbClient* client=rfbGetClient(&argc,argv,8,3,4);
+ rfbClient* client=rfbGetClient(8,3,4);
server->frameBuffer=malloc(400*300*4);
for(j=0;j<400*300*4;j++)
OpenPOWER on IntegriCloud