Permalink
Browse files

json loading: add test cases for pathological data

Add several test cases for bad JSON data.

More followup to mypaint/libmypaint#74.
  • Loading branch information...
1 parent fe82c4d commit ecbce147ef06448cdde3fd537a6c3df52432425f @achadwick achadwick committed Dec 1, 2016
View
@@ -23,6 +23,7 @@ po/POTFILES
test-driver
tests/test-details
+tests/test-brush-load
tests/*.exe
tests/*.log
tests/*.trs
View
@@ -3,6 +3,7 @@ AM_CFLAGS = -DLIBMYPAINT_TESTING_ABS_TOP_SRCDIR='"@abs_top_srcdir@"' \
-I$(srcdir)/..
TESTS = \
+ test-brush-load \
test-brush-persistence \
test-details \
test-fixed-tiled-surface \
@@ -48,6 +49,16 @@ EXTRA_DIST = \
brushes/coarse_bulk_2.myb \
brushes/impressionism.myb \
brushes/modelling.myb \
+ brushes/bad/bad_setting_types_1.myb \
+ brushes/bad/bad_setting_types_2.myb \
+ brushes/bad/bad_setting_types_3.myb \
+ brushes/bad/bad_setting_types_4.myb \
+ brushes/bad/empty.bad-myb \
+ brushes/bad/entirely_unknown_settings.bad-myb \
+ brushes/bad/missing_settings.bad-myb \
+ brushes/bad/missing_version.bad-myb \
+ brushes/bad/some_unknown_settings.myb \
+ brushes/bad/truncated.bad-myb \
events/painting30sec.dat
SUBDIRS = . gegl
@@ -0,0 +1,213 @@
+{
+ "comment": "MyPaint brush file",
+ "group": "bad",
+ "parent_brush_name": "",
+ "settings": {
+ "anti_aliasing": {
+ "base_value": 0.0,
+ "inputs": null
+ },
+ "change_color_h": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "change_color_hsl_s": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "change_color_hsv_s": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "change_color_l": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "change_color_v": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "color_h": {
+ "base_value": 0.6354166666666666,
+ "inputs": {}
+ },
+ "color_s": {
+ "base_value": 0.8807339449541285,
+ "inputs": {}
+ },
+ "color_v": {
+ "base_value": 0.42745098039215684,
+ "inputs": {}
+ },
+ "colorize": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "custom_input": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "custom_input_slowness": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "dabs_per_actual_radius": {
+ "base_value": 5.0,
+ "inputs": {}
+ },
+ "dabs_per_basic_radius": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "dabs_per_second": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "direction_filter": {
+ "base_value": 2.0,
+ "inputs": {}
+ },
+ "elliptical_dab_angle": {
+ "base_value": 90.0,
+ "inputs": {}
+ },
+ "elliptical_dab_ratio": {
+ "base_value": 1.0,
+ "inputs": {}
+ },
+ "eraser": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "hardness": {
+ "base_value": 0.2,
+ "inputs": {}
+ },
+ "lock_alpha": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "offset_by_random": {
+ "base_value": 1.6,
+ "inputs": {
+ "pressure": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 1.0,
+ -1.4
+ ]
+ ]
+ }
+ },
+ "offset_by_speed": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "offset_by_speed_slowness": {
+ "base_value": 1.0,
+ "inputs": {}
+ },
+ "opaque": {
+ "base_value": 0.4,
+ "inputs": {
+ "pressure": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 1.0,
+ 0.4
+ ]
+ ]
+ }
+ },
+ "opaque_linearize": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "opaque_multiply": {
+ "base_value": 0.0,
+ "inputs": {
+ "pressure": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 1.0,
+ 1.0
+ ]
+ ]
+ }
+ },
+ "radius_by_random": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "radius_logarithmic": {
+ "base_value": 0.7,
+ "inputs": {}
+ },
+ "restore_color": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "slow_tracking": {
+ "base_value": 2.0,
+ "inputs": {}
+ },
+ "slow_tracking_per_dab": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "smudge": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "smudge_length": {
+ "base_value": 0.5,
+ "inputs": {}
+ },
+ "smudge_radius_log": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "speed1_gamma": {
+ "base_value": 4.0,
+ "inputs": {}
+ },
+ "speed1_slowness": {
+ "base_value": 0.04,
+ "inputs": {}
+ },
+ "speed2_gamma": {
+ "base_value": 4.0,
+ "inputs": {}
+ },
+ "speed2_slowness": {
+ "base_value": 0.8,
+ "inputs": {}
+ },
+ "stroke_duration_logarithmic": {
+ "base_value": 4.0,
+ "inputs": {}
+ },
+ "stroke_holdtime": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "stroke_threshold": {
+ "base_value": 0.0,
+ "inputs": {}
+ },
+ "tracking_noise": {
+ "base_value": 0.0,
+ "inputs": {}
+ }
+ },
+ "version": 3
+}
Oops, something went wrong.

0 comments on commit ecbce14

Please sign in to comment.