aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-04-06 15:00:13 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-04-06 15:00:13 +0200
commitd057af0e2c03e95aa3d4417e355f43e87ebc903c (patch)
tree3761c0f60ce89b9b2006d3a03932461fadf2dcf7
parentb7e6f8068fc544b82875ea859c5a706234ac791f (diff)
downloadcanvas_display.lv2-d057af0e2c03e95aa3d4417e355f43e87ebc903c.tar.xz
meson: add lv2_validate, lv2lint unit tests.
-rw-r--r--VERSION2
-rw-r--r--canvas.c36
-rw-r--r--canvas_display.ttl7
-rw-r--r--meson.build19
4 files changed, 51 insertions, 13 deletions
diff --git a/VERSION b/VERSION
index 85ea6ea..5bb6eae 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.99
+0.1.415
diff --git a/canvas.c b/canvas.c
index d97945c..3b7b887 100644
--- a/canvas.c
+++ b/canvas.c
@@ -23,6 +23,7 @@
#include <lv2/lv2plug.in/ns/ext/patch/patch.h>
#include <lv2/lv2plug.in/ns/ext/log/log.h>
#include <lv2/lv2plug.in/ns/ext/log/logger.h>
+#include <lv2/lv2plug.in/ns/ext/state/state.h>
#include <canvas.lv2/forge.h>
#define LV2_CANVAS_RENDER_CAIRO
@@ -635,12 +636,7 @@ _render(LV2_Handle instance, uint32_t w, uint32_t h)
int W;
int H;
- if(handle->aspect_ratio == 0.f)
- {
- W = w;
- H = h;
- }
- else if(handle->aspect_ratio <= 1.f)
+ if(handle->aspect_ratio < 1.f)
{
W = h * handle->aspect_ratio;
H = h;
@@ -650,6 +646,11 @@ _render(LV2_Handle instance, uint32_t w, uint32_t h)
W = w;
H = w / handle->aspect_ratio;
}
+ else // handle->aspect_ratio == 0.f
+ {
+ W = w;
+ H = h;
+ }
if( (surf->width != W) || (surf->height != H) || !surf->data)
{
@@ -686,11 +687,34 @@ cleanup(LV2_Handle instance)
free(handle);
}
+static LV2_State_Status
+_state_save(LV2_Handle instance, LV2_State_Store_Function store,
+ LV2_State_Handle state, uint32_t flags,
+ const LV2_Feature *const *features)
+{
+ return LV2_STATE_SUCCESS;
+}
+
+static LV2_State_Status
+_state_restore(LV2_Handle instance, LV2_State_Retrieve_Function retrieve,
+ LV2_State_Handle state, uint32_t flags,
+ const LV2_Feature *const *features)
+{
+ return LV2_STATE_SUCCESS;
+}
+
+static const LV2_State_Interface state_iface = {
+ .save = _state_save,
+ .restore = _state_restore
+};
+
static const void *
extension_data(const char *uri)
{
if(!strcmp(uri, LV2_INLINEDISPLAY__interface))
return &idisp_iface;
+ else if(!strcmp(uri, LV2_STATE__interface))
+ return &state_iface;
return NULL;
}
diff --git a/canvas_display.ttl b/canvas_display.ttl
index 7932fd4..5306d7a 100644
--- a/canvas_display.ttl
+++ b/canvas_display.ttl
@@ -14,6 +14,7 @@
# http://www.perlfoundation.org/artistic_license_2_0.
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@@ -71,9 +72,9 @@ canvas:display
doap:name "Canvas Display" ;
doap:license lic:Artistic-2.0 ;
lv2:project proj:canvas ;
- lv2:requiredFeature urid:map ;
+ lv2:requiredFeature urid:map, state:loadDefaultState ;
lv2:optionalFeature lv2:isLive, lv2:hardRTCapable, idisp:queue_draw, log:log ;
- lv2:extensionData idisp:interface ;
+ lv2:extensionData idisp:interface, state:interface ;
lv2:port [
a lv2:InputPort ,
@@ -100,7 +101,7 @@ canvas:display
canvas:graph ;
state:state [
- canvas:aspectRatio 1.0 ;
+ canvas:aspectRatio "1.0"^^xsd:float ;
canvas:graph [
a atom:Tuple ;
rdf:value (
diff --git a/meson.build b/meson.build
index d5b5e6b..2e26e91 100644
--- a/meson.build
+++ b/meson.build
@@ -36,6 +36,8 @@ add_project_arguments('-D_GNU_SOURCE', language : 'c')
add_project_arguments('-DPUGL_HAVE_GL', language : 'c')
cp = find_program('cp')
+lv2_validate = find_program('lv2_validate', native : true, required : false)
+lv2lint = find_program('lv2lint', required : false)
clone = [cp, '@INPUT@', '@OUTPUT@']
dsp_srcs = ['canvas.c']
@@ -93,21 +95,32 @@ ui = shared_module('canvas_display_ui', ui_srcs,
suffix = mod.full_path().strip().split('.')[-1]
conf_data.set('MODULE_SUFFIX', '.' + suffix)
-configure_file(input : 'manifest.ttl.in', output : 'manifest.ttl',
+manifest_ttl = configure_file(input : 'manifest.ttl.in', output : 'manifest.ttl',
configuration : conf_data,
install : true,
install_dir : inst_dir)
-custom_target('dsp_ttl',
+dsp_ttl = custom_target('dsp_ttl',
input : 'canvas_display.ttl',
output : 'canvas_display.ttl',
command : clone,
install : true,
install_dir : inst_dir)
-custom_target('ui_ttl',
+ui_ttl = custom_target('ui_ttl',
input : 'canvas_display_ui.ttl',
output : 'canvas_display_ui.ttl',
command : clone,
install : true,
install_dir : inst_dir)
+
+if lv2_validate.found()
+ test('LV2 validate', lv2_validate,
+ args : [manifest_ttl, dsp_ttl, ui_ttl])
+endif
+
+if lv2lint.found()
+ test('LV2 lint', lv2lint,
+ args : ['-Ewarn',
+ 'http://open-music-kontrollers.ch/lv2/canvas#display'])
+endif