test-paint: Add variable font tests

These needs freetype master to work.
diff --git a/test/api/fonts/test_glyphs-glyf_colr_1_variable.ttf b/test/api/fonts/test_glyphs-glyf_colr_1_variable.ttf
new file mode 100644
index 0000000..9cc7230
--- /dev/null
+++ b/test/api/fonts/test_glyphs-glyf_colr_1_variable.ttf
Binary files differ
diff --git a/test/api/results/testvf-10 b/test/api/results/testvf-10
new file mode 100644
index 0000000..9b399db
--- /dev/null
+++ b/test/api/results/testvf-10
@@ -0,0 +1,22 @@
+# random seed: R02S4cc6a292019f2eefbbaf24127cc6b053
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 0 0 1e+03 1e+03
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 174
+        start transform 1 0 0 1 0 0
+          sweep gradient
+            center 500 600
+            angles 0 6.28
+            colors 0
+              0.25 250 240 230 255
+              0.417 0 0 255 255
+              0.583 255 0 0 255
+              0.75 47 79 79 255
+        end transform
+      end clip
+    end transform
+  end transform
+end clip
diff --git a/test/api/results/testvf-106 b/test/api/results/testvf-106
new file mode 100644
index 0000000..58f65f8
--- /dev/null
+++ b/test/api/results/testvf-106
@@ -0,0 +1,30 @@
+# random seed: R02Sa8358a35595768d4b3f0424c492c70f9
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 250 250 882 1.02e+03
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 3
+        start transform 1 0 0 1 0 0
+          solid 0 0 255 127
+        end transform
+      end clip
+    end transform
+    push group
+      start transform 1 0 0 1 1e+03 1e+03
+        start transform 1 -0.364 -0.176 1 0 0
+          start transform 1 0 0 1 -1e+03 -1e+03
+            start transform 1 0 -0 1 0 0
+              start clip glyph 3
+                start transform 1 0 0 1 0 0
+                  solid 255 165 0 178
+                end transform
+              end clip
+            end transform
+          end transform
+        end transform
+      end transform
+    pop group mode 4
+  end transform
+end clip
diff --git a/test/api/results/testvf-116 b/test/api/results/testvf-116
new file mode 100644
index 0000000..9ac2926
--- /dev/null
+++ b/test/api/results/testvf-116
@@ -0,0 +1,26 @@
+# random seed: R02S5710187ea075c431f16412c38d1f7407
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 250 250 950 950
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 3
+        start transform 1 0 0 1 0 0
+          solid 0 0 255 127
+        end transform
+      end clip
+    end transform
+    push group
+      start transform 1 0 0 1 200 200
+        start transform 1 0 -0 1 0 0
+          start clip glyph 3
+            start transform 1 0 0 1 0 0
+              solid 255 165 0 178
+            end transform
+          end clip
+        end transform
+      end transform
+    pop group mode 4
+  end transform
+end clip
diff --git a/test/api/results/testvf-123 b/test/api/results/testvf-123
new file mode 100644
index 0000000..d2d8b67
--- /dev/null
+++ b/test/api/results/testvf-123
@@ -0,0 +1,47 @@
+# random seed: R02S486e6425a6369f1d079b0c273210d642
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 0 0 1e+03 1e+03
+  start transform 1 0 0 1 0 0
+    push group
+      start transform 1 0 -0 1 0 0
+        start clip glyph 3
+          start transform 1 0 0 1 0 0
+            solid 0 0 0 255
+          end transform
+        end clip
+      end transform
+    pop group mode 3
+    push group
+      start transform 1 0 0 1 333 667
+        start transform 0.5 0 0 0.5 0 0
+          start transform 1 0 0 1 -333 -667
+            start transform 1 0 -0 1 0 0
+              start clip glyph 2
+                start transform 1 0 0 1 0 0
+                  solid 255 220 1 255
+                end transform
+              end clip
+            end transform
+          end transform
+        end transform
+      end transform
+      push group
+        start transform 1 0 0 1 667 333
+          start transform 0.5 0 0 0.5 0 0
+            start transform 1 0 0 1 -667 -333
+              start transform 1 0 -0 1 0 0
+                start clip glyph 2
+                  start transform 1 0 0 1 0 0
+                    solid 104 199 232 255
+                  end transform
+                end clip
+              end transform
+            end transform
+          end transform
+        end transform
+      pop group mode 5
+    pop group mode 3
+  end transform
+end clip
diff --git a/test/api/results/testvf-154 b/test/api/results/testvf-154
new file mode 100644
index 0000000..03eb4bc
--- /dev/null
+++ b/test/api/results/testvf-154
@@ -0,0 +1,30 @@
+# random seed: R02S3997a362a4af7aea0e7c6f803c91771c
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 0 500 500 1e+03
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 2
+        start transform 1 0 0 1 0 0
+          radial gradient
+            p0 166 768 radius 0
+            p1 166 768 radius 256
+            colors 2
+              0 0 128 0 255
+              0.5 255 255 255 255
+              1 255 0 0 255
+        end transform
+      end clip
+    end transform
+    push group
+      start transform 1 0 -0 1 0 0
+        start clip glyph 159
+          start transform 1 0 0 1 0 0
+            solid 128 128 128 102
+          end transform
+        end clip
+      end transform
+    pop group mode 3
+  end transform
+end clip
diff --git a/test/api/results/testvf-165 b/test/api/results/testvf-165
new file mode 100644
index 0000000..94de0b7
--- /dev/null
+++ b/test/api/results/testvf-165
@@ -0,0 +1,22 @@
+# random seed: R02S4f2af10d205b3b3052f5a575490a2686
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 100 250 1.2e+03 950
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 165
+        start transform 1 0 0 1 0 0
+          linear gradient
+            p0 100 950
+            p1 2.3e+03 950
+            p2 -1e+03 250
+            colors 0
+              0 255 0 0 255
+              0.5 0 0 255 255
+              1 255 255 0 255
+        end transform
+      end clip
+    end transform
+  end transform
+end clip
diff --git a/test/api/results/testvf-175 b/test/api/results/testvf-175
new file mode 100644
index 0000000..f0b6e9a
--- /dev/null
+++ b/test/api/results/testvf-175
@@ -0,0 +1,36 @@
+# random seed: R02S4c022e014005a52e2898416210be4ddf
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 0 0 1e+03 1e+03
+  start transform 1 0 0 1 0 0
+    push group
+      start transform 1 0 0 1 150 0
+        start transform 1 0 -0 1 0 0
+          start clip glyph 174
+            start transform 1 0 0 1 0 0
+              solid 0 128 0 255
+            end transform
+          end clip
+        end transform
+      end transform
+    pop group mode 3
+    push group
+      start transform 1 0 0 1 -150 0
+        start transform 1 0 -0 1 0 0
+          start clip glyph 174
+            start transform 1 0 0 1 0 0
+              linear gradient
+                p0 500 250
+                p1 500 950
+                p2 600 250
+                colors 1
+                  0 255 0 0 255
+                  1 0 0 255 255
+            end transform
+          end clip
+        end transform
+      end transform
+    pop group mode 3
+  end transform
+end clip
diff --git a/test/api/results/testvf-6 b/test/api/results/testvf-6
new file mode 100644
index 0000000..73c70ed
--- /dev/null
+++ b/test/api/results/testvf-6
@@ -0,0 +1,21 @@
+# random seed: R02Sc96e8c0cb2d824e493d9a1088730d188
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 100 250 900 950
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 6
+        start transform 1 0 0 1 0 0
+          linear gradient
+            p0 100 250
+            p1 900 250
+            p2 100 300
+            colors 1
+              0 255 0 0 255
+              1 0 0 255 255
+        end transform
+      end clip
+    end transform
+  end transform
+end clip
diff --git a/test/api/results/testvf-92 b/test/api/results/testvf-92
new file mode 100644
index 0000000..382d1ac
--- /dev/null
+++ b/test/api/results/testvf-92
@@ -0,0 +1,21 @@
+# random seed: R02See3981a17ce77670e1392178e6b57952
+# Start of hb tests
+# Start of paint tests
+# Start of ot tests
+start clip rectangle 0 0 1e+03 1e+03
+  start transform 1 0 0 1 0 0
+    start transform 1 0 -0 1 0 0
+      start clip glyph 2
+        start transform 1 0 0 1 0 0
+          radial gradient
+            p0 166 768 radius 0
+            p1 166 768 radius 256
+            colors 1
+              0 0 128 0 255
+              0.5 255 255 255 255
+              1 255 0 0 255
+        end transform
+      end clip
+    end transform
+  end transform
+end clip
diff --git a/test/api/test-paint.c b/test/api/test-paint.c
index d147027..93480f7 100644
--- a/test/api/test-paint.c
+++ b/test/api/test-paint.c
@@ -304,12 +304,13 @@
 
 #define NOTO_HAND   "fonts/noto_handwriting-cff2_colr_1.otf"
 #define TEST_GLYPHS "fonts/test_glyphs-glyf_colr_1.ttf"
+#define TEST_GLYPHS_VF "fonts/test_glyphs-glyf_colr_1_variable.ttf"
 #define BAD_COLRV1  "fonts/bad_colrv1.ttf"
 #define ROCHER_ABC  "fonts/RocherColorGX.abc.ttf"
 
 /* To verify the rendering visually, use
  *
- * hb-view --font-size SCALE --font-slant SLANT --font-palette PALETTE FONT --glyphs [gidGID=0+1000]
+ * hb-view --font-slant SLANT --font-palette PALETTE FONT --glyphs [gidGID=0+1000]
  *
  * where GID is the glyph value of the test.
  */
@@ -317,6 +318,7 @@
   /* COLRv1 */
   { NOTO_HAND,   0.,  10,   0, "hand-10" },
   { NOTO_HAND,   0.2, 10,   0, "hand-10.2" },
+
   { TEST_GLYPHS, 0,    6,   0, "test-6" },   // linear gradient
   { TEST_GLYPHS, 0,   10,   0, "test-10" },  // sweep gradient
   { TEST_GLYPHS, 0,   92,   0, "test-92" },  // radial gradient
@@ -326,7 +328,19 @@
   { TEST_GLYPHS, 0,  154,   0, "test-154" },
   { TEST_GLYPHS, 0,  165,   0, "test-165" }, // linear gradient
   { TEST_GLYPHS, 0,  175,   0, "test-175" }, // layers
+
+  { TEST_GLYPHS_VF, 0,    6,   0, "testvf-6" },
+  { TEST_GLYPHS_VF, 0,   10,   0, "testvf-10" },
+  { TEST_GLYPHS_VF, 0,   92,   0, "testvf-92" },
+  { TEST_GLYPHS_VF, 0,  106,   0, "testvf-106" },
+  { TEST_GLYPHS_VF, 0,  116,   0, "testvf-116" },
+  { TEST_GLYPHS_VF, 0,  123,   0, "testvf-123" },
+  { TEST_GLYPHS_VF, 0,  154,   0, "testvf-154" },
+  { TEST_GLYPHS_VF, 0,  165,   0, "testvf-165" },
+  { TEST_GLYPHS_VF, 0,  175,   0, "testvf-175" },
+
   { BAD_COLRV1,  0,  154,   0, "bad-154" },  // recursion
+
   /* COLRv0 */
   { ROCHER_ABC, 0.3,  1,   0, "rocher-1" },
   { ROCHER_ABC, 0.3,  2,   2, "rocher-2" },
@@ -443,21 +457,15 @@
 }
 
 static void
-test_compare_ot_ft (gconstpointer d)
+test_compare_ot_ft (const char *file, hb_codepoint_t glyph)
 {
-  hb_codepoint_t glyph = GPOINTER_TO_UINT (d);
   hb_face_t *face;
   hb_font_t *font;
   hb_paint_funcs_t *funcs;
   GString *ot_str;
   paint_data_t data;
 
-#ifndef HAVE_FT_COLRv1
-  g_test_skip ("FreeType COLRv1 support not present");
-  return;
-#endif
-
-  face = hb_test_open_font_file (TEST_GLYPHS);
+  face = hb_test_open_font_file (file);
   font = hb_font_create (face);
 
   funcs = get_test_paint_funcs ();
@@ -471,7 +479,9 @@
 
   ot_str = data.string;
 
+#ifdef HAVE_FT_COLRv1
   hb_ft_font_set_funcs (font);
+#endif
 
   data.string = g_string_new ("");
   data.level = 0;
@@ -506,6 +516,26 @@
 }
 
 static void
+test_compare_ot_ft_novf (gconstpointer d)
+{
+#ifdef HAVE_FT_COLRv1
+  test_compare_ot_ft (TEST_GLYPHS, GPOINTER_TO_UINT (d));
+#else
+  g_test_skip ("FreeType COLRv1 support not present");
+#endif
+}
+
+static void
+test_compare_ot_ft_vf (gconstpointer d)
+{
+#ifdef HAVE_FT_COLRv1
+  test_compare_ot_ft (TEST_GLYPHS_VF, GPOINTER_TO_UINT (d));
+#else
+  g_test_skip ("FreeType COLRv1 support not present");
+#endif
+}
+
+static void
 scrutinize_linear_gradient (hb_paint_funcs_t *funcs,
                             void *paint_data,
                             hb_color_line_t *color_line,
@@ -617,7 +647,8 @@
   {
     char buf[20];
     snprintf (buf, 20, "test-%u", i);
-    hb_test_add_data_flavor (GUINT_TO_POINTER (i), buf, test_compare_ot_ft);
+    hb_test_add_data_flavor (GUINT_TO_POINTER (i), buf, test_compare_ot_ft_novf);
+    hb_test_add_data_flavor (GUINT_TO_POINTER (i), buf, test_compare_ot_ft_vf);
   }
   hb_face_destroy (face);