summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-07-13 21:39:39 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2015-07-13 21:39:39 (GMT)
commitc2e7486dbc7662a55205e8fad2f1c85689eef8ec (patch)
treefd666ffe540380b2ed8fdd2c28e7ca6bef3d77e9
parent596eeb57dc79eb4ad8293282639194ae5bb7e12e (diff)
downloadlibnsfb-c2e7486dbc7662a55205e8fad2f1c85689eef8ec.tar.gz
libnsfb-c2e7486dbc7662a55205e8fad2f1c85689eef8ec.tar.bz2
add checks to tests to ensure created surface is not zero size.
-rw-r--r--test/bezier.c5
-rw-r--r--test/bitmap.c5
-rw-r--r--test/path.c5
-rw-r--r--test/plottest.c5
-rw-r--r--test/polygon.c5
-rw-r--r--test/polystar.c5
-rw-r--r--test/polystar2.c6
-rwxr-xr-xtest/runtest.sh2
8 files changed, 38 insertions, 0 deletions
diff --git a/test/bezier.c b/test/bezier.c
index 630c4a8..ea3ef12 100644
--- a/test/bezier.c
+++ b/test/bezier.c
@@ -55,6 +55,11 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
nsfb_get_buffer(nsfb, &fbptr, &fbstride);
diff --git a/test/bitmap.c b/test/bitmap.c
index b14f2f6..f4289d3 100644
--- a/test/bitmap.c
+++ b/test/bitmap.c
@@ -95,6 +95,11 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
/* claim the whole screen for update */
nsfb_claim(nsfb, &box);
diff --git a/test/path.c b/test/path.c
index 7f1c6d1..ca96047 100644
--- a/test/path.c
+++ b/test/path.c
@@ -79,6 +79,11 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
nsfb_get_buffer(nsfb, &fbptr, &fbstride);
diff --git a/test/plottest.c b/test/plottest.c
index a4cde36..cefcf5f 100644
--- a/test/plottest.c
+++ b/test/plottest.c
@@ -132,6 +132,11 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
nsfb_get_buffer(nsfb, &fbptr, &fbstride);
diff --git a/test/polygon.c b/test/polygon.c
index e91846f..6533240 100644
--- a/test/polygon.c
+++ b/test/polygon.c
@@ -57,6 +57,11 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
nsfb_get_buffer(nsfb, &fbptr, &fbstride);
diff --git a/test/polystar.c b/test/polystar.c
index 7ab6cdc..136b6aa 100644
--- a/test/polystar.c
+++ b/test/polystar.c
@@ -72,6 +72,11 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
nsfb_get_buffer(nsfb, &fbptr, &fbstride);
diff --git a/test/polystar2.c b/test/polystar2.c
index 164d429..a843f9d 100644
--- a/test/polystar2.c
+++ b/test/polystar2.c
@@ -72,6 +72,12 @@ int main(int argc, char **argv)
/* get the geometry of the whole screen */
box.x0 = box.y0 = 0;
nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ if ((box.x1 == 0) || (box.y1 == 0)) {
+ /* if surface was created with no size set a default */
+ nsfb_set_geometry(nsfb, 800, 600, NSFB_FMT_ANY);
+ nsfb_get_geometry(nsfb, &box.x1, &box.y1, NULL);
+ }
+
nsfb_get_buffer(nsfb, &fbptr, &fbstride);
radius = (box.x1 / 3);
diff --git a/test/runtest.sh b/test/runtest.sh
index 9a60b9f..5d4c271 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+set -e
+
TEST_PATH=$1
TEST_FRONTEND=ram