From 51b999465356bc3797539653360af89d4de0a706 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Tue, 9 Jan 2018 02:03:20 +0900 Subject: [PATCH 01/11] Upgrade old test schema to 0.9 format --- test/unit/data/layouts/all_items.tlf | 384 ++++++++++++++++++++++++++- test/unit/data/layouts/empty_A4L.tlf | 20 +- test/unit/data/layouts/empty_A4P.tlf | 19 +- 3 files changed, 420 insertions(+), 3 deletions(-) diff --git a/test/unit/data/layouts/all_items.tlf b/test/unit/data/layouts/all_items.tlf index f1f3f5f..6e07359 100644 --- a/test/unit/data/layouts/all_items.tlf +++ b/test/unit/data/layouts/all_items.tlf @@ -1 +1,383 @@ -{"version":"0.8.2","config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"Dynamic ItemsStatic ItemsTextText","state":{"layout-guide":[]}} \ No newline at end of file +{ + "version": "0.9.0", + "title": "", + "report": { + "paper-type": "A4", + "width": 0.0, + "height": 0.0, + "orientation": "portrait", + "margin": [ + 20.0, + 20.0, + 20.0, + 20.0 + ] + }, + "items": [ + { + "id": "rect", + "type": "rect", + "x": 20.0, + "y": 327.0, + "width": 99.1, + "height": 69.0, + "display": true, + "style": { + "border-width": 1.0, + "border-color": "#000000", + "border-style": "solid", + "fill-color": "#FFFFFF" + } + }, + { + "id": "ellipse", + "type": "ellipse", + "cx": 178.2, + "cy": 364.5, + "rx": 39.0, + "ry": 35.5, + "display": true, + "style": { + "border-width": 1.0, + "border-color": "#000000", + "border-style": "solid", + "fill-color": "#FFFFFF" + } + }, + { + "id": "line", + "type": "line", + "x1": 230.2, + "y1": 333.0, + "x2": 303.2, + "y2": 396.0, + "display": true, + "style": { + "border-width": 1.0, + "border-color": "#000000", + "border-style": "solid" + } + }, + { + "id": "text", + "type": "text", + "x": 318.1, + "y": 326.0, + "width": 136.1, + "height": 71.0, + "display": true, + "texts": [ + "Text", + "Text" + ], + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + + ], + "text-align": "left", + "vertical-align": "", + "line-height": "", + "letter-spacing": "" + } + }, + { + "id": "image", + "type": "image", + "x": 386.2, + "y": 328.0, + "width": 47.6, + "height": 67.1, + "display": true, + "data": { + "mime-type": "image/png", + "base64": "iVBORw0KGgoAAAANSUhEUgAAAlYAAANNCAYAAABVwzDzAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAJ7JJREFUeNrs3V+IJPdh4PGaME9RyOzFa5ycHnbEvVzwSjOH9ZATiG1x0mHQw66kLOiCzfRmpXB6OGk2OchDgndWKIRAbI2UBwVpN9NDjBMQJ40eFgQX4x4EG7/dbCK/3Z17yT3EWIFZiPTaVz+5JmmPurqruqu668/nA4OENN3T9ev6860/Xb0yjEUAAMzr8BeMAQBAMYQVAICwAgAQVgAAwgoAAGEFACCsAACEFQCAsAIAQFgBAAgrAABhBQBAYnWWB33yT/8UHR4eVnrCzp49G33pV77kHQaAivmH//cP0WeffVbp1/jcs88uLqxCVP3mc8+ZMwCARhoOhzM9zqlAAICCCCsAAGEFACCsAACEFQAAwgoAQFgBAAgrAABhBQCAsAIAEFYAAMIKAABhBQAgrAAAhBUAgLACAEBYAQAIKwAAYQUAIKwAABBWAADCCgBAWAEAIKwAAIQVAICwAgAQVgAACCsAAGEFACCsAACEFQAAwgoAQFgBAAgrAACEFQCAsAIAEFYAAMIKAABhBQCwHKuzPOjs2bOVn7AXr16NHnv8ce8wAFTMd3t70ff7h8LqxJd+5UuVn7AQVd2tLXMvAFTMnY8+amxYORUIACCsAACEFQCAsAIAQFgBAAgrAABhBQAgrAAAEFYAAMIKAEBYAQAgrAAAhBUAgLACABBWAAAIKwAAYQUAIKwAAIQVAADCCgBAWAEACCsAAIQVAICwAgAQVgAAwgoAAGEFACCsAACEFQCAsAIAQFgBAAgrAABhBQCAsAIAEFYAAMI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ocO+eAamZF69ejS4//3z01JNPzvU8wgoA5uB0X729+uqr0Te++c3oofX1Qp5PWAFATk731dvJ6b7Lly9HD/ziLxb63MIKADIKp/v+6nvfi17/znec7quhok73CSsAmMPHH/8o2u/tRX/67W8bjBoq+nSfsAKAnMLpvjt37kR/8kevOd1XQ+vnzkXXb9yInn766ejLZ88u7O8KKwAY4XRfvV1+9tnoxZdeKvV0n7ACgCmc7qu3cLrvmWee/fym0cskrABotf/5N3/jdF9NLet0n7ACgBHhdN/t27ejG9evO91XQ8s+3SesACD62em+999/L/rWt75lMGrov//e70Vb3StLP90nrABotXC675233orefe89g1Ez4XTftd/93ei//NZvVeZ0n7ACoHWc7qu3cHf03/+DP4wee+yxwu+OLqwAICOn++qtDqf7hBUAjRdO973713/ty5BrqG6n+4QVAI0U7o7+7rvvRt/t7bldQg3V9XSfsAKgUX48GETf/cu/dLqvpsKXIb+8fa22p/uEFQCN4HRffYXTfb8dB9V/feml2p/uE1YA1JbTffUWTve99N9ejr7+9a835nSfsAKgdsLtEv78rbec7qupcLrvygsvRP/xN36jVdMtrAColL/94Q+jvZs3ne6robac7hNWAFRaON334YcfRm/92ZtO99VQ2073CSsAKunkdN9f3Lrl7ug1FE73XX7++Up+GbKwAqA1nO6rt1dffTX6xje/GT20vm4whBUAy+B0X72F033f6F6JLl++3PrTfcIKgKUJp/v+6nvfi17/znec7qshp/uEFQAVEL4Meb+3F/3pt79tMGrI6T5hBcCShdN9d+7cif7kj15zuq+Gwu0Srt+44XSfsAJgmZzuq7fLzz4bvfjSS073CSsAlsnpvnoLp/ueeebZRn4ZsrACoDbClyE73VdPJ6f7nn766dbeHV1YAbB04XTf7du3oxvXrzvdV0NO9wkrACognO57//33fBlyTTndJ6wAqIBwuu+dt96K3n3vPYNRM073CSsAKuY/P/WUQaiZcHf03/+DP4wee+wxt0tYkpVhLO+D/ke89/Kbzz1n9Bpghre/csJpiocfPu/NpJX2er2ou7VVzgZiZcUAY/uYz+EvGDoAgGIIKwAAYQ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nJqO0793MRmrtJ23hUZIyeO06AMKLFFRt1vYSVngtlI2Zm9U5J4+0RIXiF7Kf784YUW1c2pFMIjGfwT73IQNxLj3ajfn+3dY4j2I0k5tpL2W/QrdD6l2kuXwjQnz0FrGeWiWQKjakcK8G8j7E5abtYLen4OUv3MuWVespSyfR3MuV0Wvo3dzru/uR8s5ulPq+if53bvWPMIqy8wSVjI3Mv763ag6d1zOM41FXIMx+nwhrPZzPGQ/5e7r3RwL6pVxK4Gcr+V+lPL1QlOkrXw6Y+al/Rzz0nZFZ5lxIX6hIrfAGBdKWeehIu8ft1al8UhC4m6O393OuLzMq5vjee6NWz6T9+xKjuVqp+CxHeT4+59P8zJ2vmcYp+2C1g00yGqBM+ROcmg6LJAbKQt8b8JH3o8y/re8e8V5NvbjrgM4PrU308kRDdPGrJucbpl0/6qJ9+1KDl93kufopuxVTb33V4bXcrIHuZ2ywhtEE65DS75eJ7yOM5PCauS1HEybl5JpGvda8l4PN8sK/HDKfNBPmVe2RzZax3O+1kFUwLV/yRhuJp9UTZuHPt/YTvhqpWnjcZBhPE5P52GO9yrr70/7nTBfXcqyjIcdkuRTebtjxuxeMm1nToXO8Qzvz8HI922m3b9q2jJx8noHyfNcKGgdnXm5Gvn7ad+lebKu2snwxcd55/3M81PWcZow1kcZloXNAsaXivr/AgwAddUr7RO23wAAAAAASUVORK5CYII=" + } + }, + { + "id": "text_block", + "type": "text-block", + "x": 20.0, + "y": 415.1, + "width": 180.2, + "height": 20.5, + "display": true, + "value": "", + "multiple-line": false, + "format": { + "base": "", + "type": "" + }, + "reference-id": "", + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + + ], + "text-align": "left", + "vertical-align": "", + "line-height": "", + "letter-spacing": "", + "overflow": null, + "word-wrap": "" + } + }, + { + "id": "image_block", + "type": "image-block", + "x": 212.2, + "y": 415.1, + "width": 138.0, + "height": 88.0, + "display": true, + "style": { + "position-x": "left", + "position-y": "top" + } + }, + { + "id": "page_no", + "type": "page-number", + "x": 370.2, + "y": 415.1, + "width": 151.1, + "height": 20.5, + "format": "{page}", + "target": null, + "display": true, + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + + ], + "text-align": "center", + "overflow": null + } + }, + { + "id": "list", + "type": "list", + "content-height": 156.1, + "auto-page-break": true, + "display": true, + "header": { + "height": 39.0, + "translate": { + "x": 0.0, + "y": 134.9 + }, + "items": [ + + ], + "enabled": true + }, + "detail": { + "height": 39.0, + "translate": { + "x": 0.0, + "y": 134.9 + }, + "items": [ + + ] + }, + "page-footer": { + "height": 29.3, + "translate": { + "x": 0.0, + "y": 134.9 + }, + "items": [ + + ], + "enabled": true + }, + "footer": { + "height": 29.3, + "translate": { + "x": 0.0, + "y": 134.90000000000006 + }, + "items": [ + + ], + "enabled": true + }, + "x": 20.0, + "y": 530.0, + "width": 346.2, + "height": 195.1 + }, + { + "id": "", + "type": "rect", + "x": 20.0, + "y": 80.0, + "width": 98.1, + "height": 73.0, + "display": true, + "style": { + "border-width": 1.0, + "border-color": "#000000", + "border-style": "solid", + "fill-color": "#FFFFFF" + } + }, + { + "id": "", + "type": "text", + "x": 233.6, + "y": 275.0, + "width": 128.1, + "height": 20.5, + "display": true, + "texts": [ + "Dynamic Items" + ], + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + "bold" + ], + "text-align": "left", + "vertical-align": "", + "line-height": "", + "letter-spacing": "" + } + }, + { + "id": "", + "type": "text", + "x": 233.6, + "y": 20.0, + "width": 128.1, + "height": 20.5, + "display": true, + "texts": [ + "Static Items" + ], + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + "bold" + ], + "text-align": "center", + "vertical-align": "", + "line-height": "", + "letter-spacing": "" + } + }, + { + "id": "", + "type": "ellipse", + "cx": 178.65, + "cy": 117.55, + "rx": 41.55, + "ry": 34.55, + "display": true, + "style": { + "border-width": 1.0, + "border-color": "#000000", + "border-style": "solid", + "fill-color": "#FFFFFF" + } + }, + { + "id": "", + "type": "line", + "x1": 239.2, + "y1": 81.0, + "x2": 299.2, + "y2": 140.0, + "display": true, + "style": { + "border-width": 1.0, + "border-color": "#000000", + "border-style": "solid" + } + }, + { + "id": "", + "type": "text", + "x": 315.2, + "y": 75.0, + "width": 82.1, + "height": 85.1, + "display": true, + "texts": [ + "Text", + "Text" + ], + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + + ], + "text-align": "left", + "vertical-align": "", + "line-height": "", + "letter-spacing": "" + } + }, + { + "id": "", + "type": "image", + "x": 387.1, + "y": 79.0, + "width": 46.9, + "height": 66.1, + "display": true, + "data": { + "mime-type": "image/png", + "base64": "iVBORw0KGgoAAAANSUhEUgAAAlYAAANNCAYAAABVwzDzAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAJ7JJREFUeNrs3V+IJPdh4PGaME9RyOzFa5ycHnbEvVzwSjOH9ZATiG1x0mHQw66kLOiCzfRmpXB6OGk2OchDgndWKIRAbI2UBwVpN9NDjBMQJ40eFgQX4x4EG7/dbCK/3Z17yT3EWIFZiPTaVz+5JmmPurqruqu668/nA4OENN3T9ev6860/Xb0yjEUAAMzr8BeMAQBAMYQVAICwAgAQVgAAwgoAAGEFACCsAACEFQCAsAIAQFgBAAgrAABhBQBAYnWWB33yT/8UHR4eVnrCzp49G33pV77kHQaAivmH//cP0WeffVbp1/jcs88uLqxCVP3mc8+ZMwCARhoOhzM9zqlAAICCCCsAAGEFACCsAACEFQAAwgoAQFgBAAgrAABhBQCAsAIAEFYAAMIKAABhBQAgrAAAhBUAgLACAEBYAQAIKwAAYQUAIKwAABBWAADCCgBAWAEAIKwAAIQVAICwAgAQVgAACCsAAGEFACCsAACEFQAAwgoAQFgBAAgrAACEFQCAsAIAEFYAAMIKAABhB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EFQCAsAIAEFYAAAgrAABhBQAgrAAAhBUAAMIKAEBYAQAIKwAAYQUAgLACABBWAADCCgAAYQUAIKwAAIQVAICwAgBAWAEACCsAAGEFACCsAAAQVgAAwgoAQFgBACCsAACEFQCAsAIAEFYAAAgrAIDlWDUE1N3581+NhsOhgYCCWa7m97c//GG0d/Nm9M6tWwZDWAEAeX362WfRhx9+GL31Z29G3+8fGpCa+U+dC9E3uleEFQAs008/+ST687feiv7i1q1ocO+eAamZF69ejS4//3z01JNPzvU8wgoA5uB0X729+uqr0Te++c3oofX1Qp5PWAFATk731dvJ6b7Lly9HD/ziLxb63MIKADIKp/v+6nvfi17/znec7quhok73CSsAmMPHH/8o2u/tRX/67W8bjBoq+nSfsAKAnMLpvjt37kR/8kevOd1XQ+vnzkXXb9yInn766ejLZ88u7O8KKwAY4XRfvV1+9tnoxZdeKvV0n7ACgCmc7qu3cLrvmWee/fym0cskrABotf/5N3/jdF9NLet0n7ACgBHhdN/t27ejG9evO91XQ8s+3SesACD62em+999/L/rWt75lMGrov//e70Vb3StLP90nrABotXC675233orefe89g1Ez4XTftd/93ei//NZvVeZ0n7ACoHWc7qu3cHf03/+DP4wee+yxwu+OLqwAICOn++qtDqf7hBUAjRdO973713/ty5BrqG6n+4QVAI0U7o7+7rvvRt/t7bldQg3V9XSfsAKgUX48GETf/cu/dLqvpsKXIb+8fa22p/uEFQCN4HRffYXTfb8dB9V/feml2p/uE1YA1JbTffUWTve99N9ejr7+9a835nSfsAKgdsLtEv78rbec7qupcLrvygsvRP/xN36jVdMtrAColL/94Q+jvZs3ne6robac7hNWAFRaON334YcfRm/92ZtO99VQ2073CSsAKunkdN9f3Lrl7ug1FE73XX7++Up+GbKwAqA1nO6rt1dffTX6xje/GT20vm4whBUAy+B0X72F033f6F6JLl++3PrTfcIKgKUJp/v+6nvfi17/znec7qshp/uEFQAVEL4Meb+3F/3pt79tMGrI6T5hBcCShdN9d+7cif7kj15zuq+Gwu0Srt+44XSfsAJgmZzuq7fL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MZZchz0Xc/5ehGZ8KyV5R/WcYzfp9fmevozYzz6uGUsNtcxDqmgHHamHNb5oMFLTD3qcDkMH9YaE4f5t9OZsTOkmewSfexyrtAFHkqY9yYbSUrzDMpf+v0R6570fjTF0fJTVG3Mo77uOtslvX+hQ8nXBwzLpM28lnex0n3sarax9EnXetT9GsN7+PeuDFN5qFxG+7DGa53PI6qL22ZybMRDh9EOSgwrNL+zlFyenXq8pmso8ctV9cLWMYnrV/PnJqO0793MRmrtJ23hUZIyeO06AMKLFFRt1vYSVngtlI2Zm9U5J4+0RIXiF7Kf784YUW1c2pFMIjGfwT73IQNxLj3ajfn+3dY4j2I0k5tpL2W/QrdD6l2kuXwjQnz0FrGeWiWQKjakcK8G8j7E5abtYLen4OUv3MuWVespSyfR3MuV0Wvo3dzru/uR8s5ulPq+if53bvWPMIqy8wSVjI3Mv763ag6d1zOM41FXIMx+nwhrPZzPGQ/5e7r3RwL6pVxK4Gcr+V+lPL1QlOkrXw6Y+al/Rzz0nZFZ5lxIX6hIrfAGBdKWeehIu8ft1al8UhC4m6O393OuLzMq5vjee6NWz6T9+xKjuVqp+CxHeT4+59P8zJ2vmcYp+2C1g00yGqBM+ROcmg6LJAbKQt8b8JH3o8y/re8e8V5NvbjrgM4PrU308kRDdPGrJucbpl0/6qJ9+1KDl93kufopuxVTb33V4bXcrIHuZ2ywhtEE65DS75eJ7yOM5PCauS1HEybl5JpGvda8l4PN8sK/HDKfNBPmVe2RzZax3O+1kFUwLV/yRhuJp9UTZuHPt/YTvhqpWnjcZBhPE5P52GO9yrr70/7nTBfXcqyjIcdkuRTebtjxuxeMm1nToXO8Qzvz8HI922m3b9q2jJx8noHyfNcKGgdnXm5Gvn7ad+lebKu2snwxcd55/3M81PWcZow1kcZloXNAsaXivr/AgwAddUr7RO23wAAAAAASUVORK5CYII=" + } + }, + { + "id": "", + "type": "page-number", + "x": 20.0, + "y": 185.1, + "width": 187.2, + "height": 20.5, + "format": "{page}", + "target": null, + "display": true, + "style": { + "font-family": [ + "Helvetica" + ], + "font-size": 18.0, + "color": "#000000", + "font-style": [ + + ], + "text-align": "center", + "overflow": null + } + } + ] +} \ No newline at end of file diff --git a/test/unit/data/layouts/empty_A4L.tlf b/test/unit/data/layouts/empty_A4L.tlf index 218ef57..9202a7e 100644 --- a/test/unit/data/layouts/empty_A4L.tlf +++ b/test/unit/data/layouts/empty_A4L.tlf @@ -1 +1,19 @@ -{"version":"0.8.2","config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"landscape","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"","state":{"layout-guide":[]}} \ No newline at end of file +{ + "version": "0.9.0", + "title": "", + "report": { + "paper-type": "A4", + "width": 0.0, + "height": 0.0, + "orientation": "landscape", + "margin": [ + 20.0, + 20.0, + 20.0, + 20.0 + ] + }, + "items": [ + + ] +} \ No newline at end of file diff --git a/test/unit/data/layouts/empty_A4P.tlf b/test/unit/data/layouts/empty_A4P.tlf index a29bddb..a9e8c05 100644 --- a/test/unit/data/layouts/empty_A4P.tlf +++ b/test/unit/data/layouts/empty_A4P.tlf @@ -1 +1,18 @@ -{"version":"0.8.2","config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"","state":{"layout-guide":[]}} +{ + "version": "0.10.0", + "items": [], + "state": { + "layout-guides": [] + }, + "title": "", + "report": { + "paper-type": "A4", + "orientation": "portrait", + "margin": [ + 20, + 20, + 20, + 20 + ] + } +} \ No newline at end of file From fda061f6d9cac4d2d566379982414c542e7aca53 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Tue, 9 Jan 2018 02:07:06 +0900 Subject: [PATCH 02/11] Support 0.9+ format schema --- src/Thinreports/Layout.php | 186 +++++++++++-------------- test/unit/Thinreports/LayoutTest.php | 197 ++++++++++++--------------- 2 files changed, 167 insertions(+), 216 deletions(-) diff --git a/src/Thinreports/Layout.php b/src/Thinreports/Layout.php index 378b8e4..795c60c 100644 --- a/src/Thinreports/Layout.php +++ b/src/Thinreports/Layout.php @@ -17,7 +17,7 @@ class Layout { const FILE_EXT_NAME = 'tlf'; const COMPATIBLE_VERSION_RANGE_START = '>= 0.8.2'; - const COMPATIBLE_VERSION_RANGE_END = '< 0.9.0'; + const COMPATIBLE_VERSION_RANGE_END = '< 1.0.0'; /** * @param string $filename @@ -34,7 +34,19 @@ static public function loadFile($filename) throw new Exception\StandardException('Layout File Not Found', $filename); } - return new self($filename, self::parse(file_get_contents($filename, true))); + return self::loadData(file_get_contents($filename, true)); + } + + /** + * @param string $data + * @return self + */ + static public function loadData($data) + { + $schema = self::parse($data); + $identifier = md5($data); + + return new self($schema, $identifier); } /** @@ -46,64 +58,17 @@ static public function loadFile($filename) */ static public function parse($file_content) { - $format = json_decode($file_content, true); + $schema = json_decode($file_content, true); - if (!self::isCompatible($format['version'])) { + if (!self::isCompatible($schema['version'])) { $rules = array( self::COMPATIBLE_VERSION_RANGE_START, self::COMPATIBLE_VERSION_RANGE_END ); - throw new Exception\IncompatibleLayout($format['version'], $rules); + throw new Exception\IncompatibleLayout($schema['version'], $rules); } - $item_formats = self::extractItemFormats($format['svg']); - self::cleanFormat($format); - - return array( - 'format' => $format, - 'item_formats' => $item_formats - ); - } - - /** - * @access private - * - * @param string $layout_format - * @return array - */ - static public function extractItemFormats($layout_format) - { - preg_match_all('//', - $layout_format, $matched_items, PREG_SET_ORDER); - - $item_formats = array(); - - foreach ($matched_items as $matched_item) { - $item_format_json = $matched_item[1]; - $item_format = json_decode($item_format_json, true); - - if ($item_format['type'] === 's-list') { - continue; - } - if ($item_format['type'] === Item\PageNumberItem::TYPE_NAME) { - self::setPageNumberUniqueId($item_format); - } - - $item_formats[$item_format['id']] = $item_format; - } - - return $item_formats; - } - - /** - * @access private - * - * @param array $format - */ - static public function cleanFormat(&$format) - { - $format['svg'] = preg_replace('//', '', $format['svg']); - unset($format['state']); + return $schema; } /** @@ -129,40 +94,19 @@ static public function isCompatible($layout_version) return true; } - /** - * @access private - * - * @param array $item_format - */ - static public function setPageNumberUniqueId(array &$item_format) - { - if (empty($item_format['id'])) { - $item_format['id'] = Item\PageNumberItem::generateUniqueId(); - } - } - - private $format; - private $item_foramts = array(); + private $schema; private $identifier; + private $item_schemas; /** - * @param string $filename - * @param array $deinition array('format' => array, 'item_formats' => array) + * @param array $schema + * @param string $identifier */ - public function __construct($filename, array $definition) + public function __construct(array $schema, $identifier) { - $this->filename = $filename; - $this->format = $definition['format']; - $this->item_formats = $definition['item_formats']; - $this->identifier = md5($this->format['svg']); - } - - /** - * @return string - */ - public function getFilename() - { - return $this->filename; + $this->schema = $schema; + $this->identifier = $identifier; + $this->item_schemas = $this->buildItemSchemas($schema['items']); } /** @@ -170,7 +114,7 @@ public function getFilename() */ public function getReportTitle() { - return $this->format['config']['title']; + return $this->schema['title']; } /** @@ -178,7 +122,7 @@ public function getReportTitle() */ public function getPagePaperType() { - return $this->format['config']['page']['paper-type']; + return $this->schema['report']['paper-type']; } /** @@ -187,8 +131,10 @@ public function getPagePaperType() public function getPageSize() { if ($this->isUserPaperType()) { - $page = $this->format['config']['page']; - return array($page['width'], $page['height']); + return array( + $this->schema['report']['width'], + $this->schema['report']['height'] + ); } else { return null; } @@ -199,7 +145,7 @@ public function getPageSize() */ public function isPortraitPage() { - return $this->format['config']['page']['orientation'] === 'portrait'; + return $this->schema['report']['orientation'] === 'portrait'; } /** @@ -207,7 +153,7 @@ public function isPortraitPage() */ public function isUserPaperType() { - return $this->format['config']['page']['paper-type'] === 'user'; + return $this->schema['report']['paper-type'] === 'user'; } /** @@ -217,17 +163,30 @@ public function isUserPaperType() */ public function getLastVersion() { - return $this->format['version']; + return $this->schema['version']; } /** * @access private * - * @return string + * @param array $item_schemas + * @return array array('with_id' => array, 'without_id' => array) */ - public function getSVG() + public function buildItemSchemas(array $item_schemas) { - return $this->format['svg']; + $with_id = $without_id = array(); + + foreach ($item_schemas as $item_schema) { + $item_id = $item_schema['id']; + + if ($item_id === '') { + $without_id[] = $item_schema; + } else { + $with_id[$item_id] = $item_schema; + } + } + + return array('with_id' => $with_id, 'without_id' => $without_id); } /** @@ -236,9 +195,9 @@ public function getSVG() * @param string $id * @return boolean */ - public function hasItem($id) + public function hasItemById($id) { - return array_key_exists($id, $this->item_formats); + return array_key_exists($id, $this->item_schemas['with_id']); } /** @@ -251,24 +210,24 @@ public function hasItem($id) */ public function createItem(Page $owner, $id) { - if (!$this->hasItem($id)) { + if (!$this->hasItemById($id)) { throw new Exception\StandardException('Item Not Found', $id); } - $item_format = $this->item_formats[$id]; + $item_schema = $this->item_schemas['with_id'][$id]; - switch ($item_format['type']) { - case 's-tblock': - return new Item\TextBlockItem($owner, $item_format); + switch ($item_schema['type']) { + case 'text-block': + return new Item\TextBlockItem($owner, $item_schema); break; - case 's-iblock': - return new Item\ImageBlockItem($owner, $item_format); + case 'image-block': + return new Item\ImageBlockItem($owner, $item_schema); break; - case 's-pageno'; - return new Item\PageNumberItem($owner, $item_format); + case 'page-number'; + return new Item\PageNumberItem($owner, $item_schema); break; default: - return new Item\BasicItem($owner, $item_format); + return new Item\BasicItem($owner, $item_schema); break; } } @@ -288,18 +247,29 @@ public function getIdentifier() * * @return array */ - public function getFormat() + public function getSchema() { - return $this->format; + return $this->schema; } /** * @access private * + * @param string $filter all|with_id|without_id * @return array */ - public function getItemFormats() + public function getItemSchemas($filter = 'all') { - return $this->item_formats; + switch ($filter) { + case 'all': + return $this->schema['items']; + break; + case 'with_id': + return $this->item_schemas['with_id']; + break; + case 'without_id': + return $this->item_schemas['without_id']; + break; + } } } diff --git a/test/unit/Thinreports/LayoutTest.php b/test/unit/Thinreports/LayoutTest.php index 784ad76..50670e3 100644 --- a/test/unit/Thinreports/LayoutTest.php +++ b/test/unit/Thinreports/LayoutTest.php @@ -17,11 +17,16 @@ function test_loadFile() $layout = Layout::loadFile($this->dataLayoutFile('empty_A4P.tlf')); $this->assertInstanceOf('Thinreports\Layout', $layout); + } - $layout = Layout::loadFile($this->dataLayoutFile('all_items')); - $this->assertInstanceOf('Thinreports\Layout', $layout); + function test_loadData() + { + $schema_data = '{"version":"0.10.1", "items":[]}'; - $this->assertCount(9, $layout->getItemFormats()); + $layout = Layout::loadData($schema_data); + + $this->assertInstanceOf('Thinreports\Layout', $layout); + $this->assertAttributeEquals(md5($schema_data), 'identifier', $layout); } function test_parse() @@ -34,71 +39,66 @@ function test_parse() } try { - Layout::parse('{"version":"0.9.0"}'); + Layout::parse('{"version":"1.0.0"}'); $this->fail(); } catch (Exception\IncompatibleLayout $e) { // OK } - $parsed_format = Layout::parse('{"version":"0.8.2", "svg":""}'); + $schema = Layout::parse('{"version":"0.9.0", "items":[]}'); - $this->assertSame(array('version' => '0.8.2', 'svg' => ''), $parsed_format['format']); - $this->assertSame(array(), $parsed_format['item_formats']); + $this->assertEquals(array('version' => '0.9.0', 'items' => array()), $schema); } - function test_cleanFormat() + function test_initialize() { - $svg = '' . - '' . - ''; - $format = array( - 'svg' => $svg, - 'state' => array() + $schema = array( + 'version' => '0.10.1', + 'items' => array( + array('id' => '', 'type' => 'rect'), + array('id' => 'foo', 'type' => 'text-block'), + array('id' => 'bar', 'type' => 'text'), + array('id' => '', 'type' => 'line') + ) ); - Layout::cleanFormat($format); - $this->assertEquals('', $format['svg']); - $this->assertArrayNotHasKey('state', $format); + $layout = new Layout($schema, 'layout_identifier'); + + $this->assertAttributeSame($schema, 'schema', $layout); + $this->assertAttributeEquals('layout_identifier', 'identifier', $layout); + $this->assertAttributeEquals( + array( + 'with_id' => array( + 'foo' => array('id' => 'foo', 'type' => 'text-block'), + 'bar' => array('id' => 'bar', 'type' => 'text') + ), + 'without_id' => array( + array('id' => '', 'type' => 'rect'), + array('id' => '', 'type' => 'line') + ) + ), + 'item_schemas', + $layout + ); } - function test_extractItemFormats() + function test_hasItemById() { - $layout = <<<'SVG' - - - - - - - - - -SVG; - $formats = Layout::extractItemFormats($layout); - - $this->assertCount(4, $formats); - $this->assertEquals(array('type' => 's-tblock', 'id' => 'text_block1'), $formats['text_block1']); - $this->assertEquals(array('type' => 's-tblock', 'id' => 'text_block2'), $formats['text_block2']); - $this->assertEquals(array('type' => 's-pageno', 'id' => 'page_no'), $formats['page_no']); - $this->assertCount(1, preg_grep('/^__page_no_/', array_keys($formats))); - - $this->assertArrayNotHasKey('s-list', $formats); - } + $item_schemas = array( + array('id' => 'foo', 'type' => 'rect'), + array('id' => 'bar', 'type' => 'text-block') + ); - function test_hasItem() - { - $item_formats = array('foo_id' => array()); - $layout = new Layout('dummy.tlf', array( - 'format' => array('svg' => ''), - 'item_formats' => $item_formats - )); + $layout = new Layout(array('items' => $item_schemas), 'identifier'); - $this->assertTrue($layout->hasItem('foo_id')); - $this->assertFalse($layout->hasItem('unknown_id')); + $this->assertTrue($layout->hasItemById('bar')); + $this->assertFalse($layout->hasItemById('unknown')); } function test_createItem() { + $this->markTestSkipped('Item classes are not supported yet'); + $item_formats = $this->dataItemFormats(array( array('text_block', 'default'), array('image_block', 'default'), @@ -161,53 +161,39 @@ function test_createItem() * Layout::isUserPaperType * Layout::isPortraitPage * Layout::getPageSize - * Layout::getSVG */ - function test_getters_for_Layout_configuration() + function test_schema_attribute_getters() { - $regular_paper_type_format = array( - 'version' => '0.8.2', - 'config' => array( - 'title' => 'Report Title', - 'page' => array( - 'paper-type' => 'A4', - 'orientation' => 'landscape', - ) + $schema = array( + 'version' => '0.10.1', + 'title' => 'Report Title', + 'report' => array( + 'paper-type' => 'A4', + 'orientation' => 'landscape', ), - 'svg' => '' + 'items' => array() ); - $layout = new Layout('dummy.tlf', array( - 'format' => $regular_paper_type_format, - 'item_formats' => array() - )); + $layout = new Layout($schema, 'identifier'); - $this->assertEquals('0.8.2', $layout->getLastVersion()); + $this->assertEquals('0.10.1', $layout->getLastVersion()); $this->assertEquals('Report Title', $layout->getReportTitle()); $this->assertEquals('A4', $layout->getPagePaperType()); $this->assertFalse($layout->isUserPaperType()); $this->assertFalse($layout->isPortraitPage()); $this->assertNull($layout->getPageSize()); - $this->assertEquals('', $layout->getSVG()); - - $user_paper_type_format = array( - 'version' => '0.8.2', - 'config' => array( - 'title' => 'Report Title', - 'page' => array( - 'paper-type' => 'user', - 'orientation' => 'landscape', - 'width' => 100.9, - 'height' => 999.9 - ) + + $schema = array( + 'report' => array( + 'paper-type' => 'user', + 'orientation' => 'portrait', + 'width' => 100.9, + 'height' => 999.9 ), - 'svg' => '' + 'items' => array() ); - $layout = new Layout('dummy.tlf', array( - 'format' => $user_paper_type_format, - 'item_formats' => array() - )); + $layout = new Layout($schema, 'identifier'); $this->assertEquals('user', $layout->getPagePaperType()); $this->assertTrue($layout->isUserPaperType()); @@ -216,41 +202,36 @@ function test_getters_for_Layout_configuration() function test_getIdentifier() { - $format = array( - 'svg' => '' - ); - - $layout = new Layout('dummy.tlf', array( - 'format' => $format, - 'item_formats' => array() - )); - $this->assertEquals(md5(''), $layout->getIdentifier()); + $layout = new Layout(array('items' => array()), 'identifier'); + $this->assertEquals('identifier', $layout->getIdentifier()); } - function test_getFormat() + function test_getSchema() { - $format = array( - 'version' => '0.8.2', - 'svg' => '' - ); + $schema = array('version' => '0.10.1', 'items' => array()); + $layout = new Layout($schema, 'identifier'); - $layout = new Layout('dummy.tlf', array( - 'format' => $format, - 'item_formats' => array() - )); - $this->assertSame($format, $layout->getFormat()); + $this->assertSame($schema, $layout->getSchema()); } - function test_getItemFormats() + function test_getItemSchemas() { - $item_formats = array( - 'rect_id' => array('type' => 's-rect') + $item_schemas = array( + array('id' => 'text1', 'type' => 'text-block'), + array('id' => '', 'type' => 'rect') ); - $layout = new Layout('dummy.tlf', array( - 'format' => array('svg' => ''), - 'item_formats' => $item_formats - )); - $this->assertSame($item_formats, $layout->getItemFormats()); + $layout = new Layout(array('items' => $item_schemas), 'identifier'); + + $this->assertSame($item_schemas, $layout->getItemSchemas()); + $this->assertSame($item_schemas, $layout->getItemSchemas('all')); + $this->assertEquals( + array('text1' => array('id' => 'text1', 'type' => 'text-block')), + $layout->getItemSchemas('with_id') + ); + $this->assertEquals( + array(array('id' => '', 'type' => 'rect')), + $layout->getItemSchemas('without_id') + ); } } From 53e64c8c1c3b54b56a96a70aaa5235fbf229d701 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Sun, 14 Jan 2018 01:48:30 +0900 Subject: [PATCH 03/11] Support 0.9+ format: AbstractItem --- src/Thinreports/Item/AbstractItem.php | 38 +++++-------------- .../Thinreports/Item/AbstractItemTest.php | 33 ++++++---------- 2 files changed, 21 insertions(+), 50 deletions(-) diff --git a/src/Thinreports/Item/AbstractItem.php b/src/Thinreports/Item/AbstractItem.php index 0f3da05..0194452 100644 --- a/src/Thinreports/Item/AbstractItem.php +++ b/src/Thinreports/Item/AbstractItem.php @@ -14,20 +14,20 @@ abstract class AbstractItem { protected $parent; - protected $format; + protected $schema; protected $is_visible; protected $style; /** * @param Page $parent - * @param array $format + * @param array $schema */ - public function __construct(Page $parent, array $format) + public function __construct(Page $parent, array $schema) { $this->parent = $parent; - $this->format = $format; - $this->is_visible = $format['display'] === 'true'; + $this->schema = $schema; + $this->is_visible = $schema['display'] === true; } /** @@ -71,7 +71,7 @@ public function show() */ public function getId() { - return $this->format['id']; + return $this->schema['id']; } /** @@ -140,19 +140,9 @@ public function getParent() * * @return array */ - public function getFormat() + public function getSchema() { - return $this->format; - } - - /** - * @access private - * - * @return string - */ - public function getType() - { - return $this->format['type']; + return $this->schema; } /** @@ -163,17 +153,7 @@ public function getType() */ public function isTypeOf($type_name) { - return $this->getType() === $type_name; - } - - /** - * @access private - * - * @return array - */ - public function getSVGAttributes() - { - return $this->format['svg']['attrs']; + return $this->schema['type'] === $type_name; } /** diff --git a/test/unit/Thinreports/Item/AbstractItemTest.php b/test/unit/Thinreports/Item/AbstractItemTest.php index ed1f64e..16dd9b6 100644 --- a/test/unit/Thinreports/Item/AbstractItemTest.php +++ b/test/unit/Thinreports/Item/AbstractItemTest.php @@ -37,10 +37,10 @@ function setup() function test_initialize() { - $item = new TestItem($this->page, array('display' => 'true')); + $item = new TestItem($this->page, array('display' => true)); $this->assertTrue($item->isVisible()); - $item = new TestItem($this->page, array('display' => 'false')); + $item = new TestItem($this->page, array('display' => false)); $this->assertFalse($item->isVisible()); } @@ -51,9 +51,9 @@ function test_initialize() * AbstractItem::show * AbstractItem::hide */ - function test_isVisible() + function test_methods_for_visibility() { - $item = new TestItem($this->page, array('display' => 'true')); + $item = new TestItem($this->page, array('display' => true)); $item->setVisible(false); $this->assertFalse($item->isVisible()); @@ -103,34 +103,25 @@ function test_exportStyles() function test_getParent() { - $item = new TestItem($this->page, array('display' => 'true')); + $item = new TestItem($this->page, array('display' => true)); $this->assertSame($this->page, $item->getParent()); } - function test_getFormat() + function test_getSchema() { - $item = new TestItem($this->page, array('display' => 'true')); - $this->assertSame(array('display' => 'true'), $item->getFormat()); + $schema = array('display' => true); + $item = new TestItem($this->page, $schema); + $this->assertSame($schema, $item->getSchema()); } - /** - * Tests for: - * AbstractItem::getId - * AbstractItem::getType - * AbstractItem::getSVGAttributes - */ - function test_getters_for_Item_attribute() + function test_getId() { $item = new TestItem($this->page, array( - 'display' => 'true', - 'id' => 'foo_id', - 'type' => 'foo_type', - 'svg' => array('attrs' => array('attr' => 'value')) + 'display' => true, + 'id' => 'foo_id' )); $this->assertEquals('foo_id', $item->getId()); - $this->assertEquals('foo_type', $item->getType()); - $this->assertEquals(array('attr' => 'value'), $item->getSVGAttributes()); } function test_isTypeOf() From 79607ea0eba167473bf3968ecf180707910946b7 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Sun, 14 Jan 2018 03:11:46 +0900 Subject: [PATCH 04/11] Support 0.9+ format: AbstractBlockItem --- src/Thinreports/Item/AbstractBlockItem.php | 7 ++++++- .../Thinreports/Item/AbstractBlockItemTest.php | 17 ++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Thinreports/Item/AbstractBlockItem.php b/src/Thinreports/Item/AbstractBlockItem.php index f713143..588ec67 100644 --- a/src/Thinreports/Item/AbstractBlockItem.php +++ b/src/Thinreports/Item/AbstractBlockItem.php @@ -53,7 +53,12 @@ public function isPresent() */ public function getBounds() { - return $this->format['box']; + return array( + 'x' => $this->schema['x'], + 'y' => $this->schema['y'], + 'width' => $this->schema['width'], + 'height' => $this->schema['height'] + ); } /** diff --git a/test/unit/Thinreports/Item/AbstractBlockItemTest.php b/test/unit/Thinreports/Item/AbstractBlockItemTest.php index 8efb222..73e2ab0 100644 --- a/test/unit/Thinreports/Item/AbstractBlockItemTest.php +++ b/test/unit/Thinreports/Item/AbstractBlockItemTest.php @@ -14,17 +14,15 @@ function setup() { $report = new Report($this->dataLayoutFile('empty_A4P.tlf')); $parent = $report->addPage(); - $format = array( + $schema = array( 'type' => 'test-block', - 'display' => 'true', - 'box' => array( - 'x' => 100, - 'y' => 100, - 'width' => 100, - 'height' => 100 - ) + 'display' => true, + 'x' => 100, + 'y' => 100, + 'width' => 100, + 'height' => 100 ); - $this->test_item = new TestBlockItem($parent, $format); + $this->test_item = new TestBlockItem($parent, $schema); } function test_setValue() @@ -86,5 +84,6 @@ function test_getBounds() function test_isTypeOf() { $this->assertTrue($this->test_item->isTypeOf('block')); + $this->assertTrue($this->test_item->isTypeOf('test-block')); } } From 21ba9ab2a3ca38154d1c8be4c26e24f1663139d7 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Tue, 16 Jan 2018 00:52:16 +0900 Subject: [PATCH 05/11] Support 0.9+ format: BasicItem --- src/Thinreports/Item/BasicItem.php | 51 +++++++------- test/unit/Thinreports/Item/BasicItemTest.php | 70 ++++++++++---------- test/unit/data/items/ellipse.yml | 24 +++---- test/unit/data/items/image.yml | 19 +++--- test/unit/data/items/line.yml | 22 +++--- test/unit/data/items/rect.yml | 28 ++++---- test/unit/data/items/text.yml | 40 +++++------ 7 files changed, 119 insertions(+), 135 deletions(-) diff --git a/src/Thinreports/Item/BasicItem.php b/src/Thinreports/Item/BasicItem.php index b662cba..50846ff 100644 --- a/src/Thinreports/Item/BasicItem.php +++ b/src/Thinreports/Item/BasicItem.php @@ -19,19 +19,19 @@ class BasicItem extends AbstractItem /** * {@inheritdoc} */ - public function __construct(Page $parent, array $format) + public function __construct(Page $parent, array $schema) { - parent::__construct($parent, $format); + parent::__construct($parent, $schema); switch (true) { case $this->isImage(): - $this->style = new Style\BasicStyle($format); + $this->style = new Style\BasicStyle($schema); break; case $this->isText(): - $this->style = new Style\TextStyle($format); + $this->style = new Style\TextStyle($schema); break; default: - $this->style = new Style\GraphicStyle($format); + $this->style = new Style\GraphicStyle($schema); break; } } @@ -43,7 +43,7 @@ public function __construct(Page $parent, array $format) */ public function isImage() { - return $this->isTypeOf('s-image'); + return $this->isTypeOf('image'); } /** @@ -53,7 +53,7 @@ public function isImage() */ public function isText() { - return $this->isTypeOf('s-text'); + return $this->isTypeOf('text'); } /** @@ -63,7 +63,7 @@ public function isText() */ public function isRect() { - return $this->isTypeOf('s-rect'); + return $this->isTypeOf('rect'); } /** @@ -73,7 +73,7 @@ public function isRect() */ public function isEllipse() { - return $this->isTypeOf('s-ellipse'); + return $this->isTypeOf('ellipse'); } /** @@ -83,7 +83,7 @@ public function isEllipse() */ public function isLine() { - return $this->isTypeOf('s-line'); + return $this->isTypeOf('line'); } /** @@ -99,34 +99,31 @@ public function isTypeOf($type_name) */ public function getBounds() { - $svg_attrs = $this->getSVGAttributes(); + $schema = $this->schema; switch (true) { - case $this->isImage() || $this->isRect(): + case $this->isImage() || $this->isRect() || $this->isText(): return array( - 'x' => $svg_attrs['x'], - 'y' => $svg_attrs['y'], - 'width' => $svg_attrs['width'], - 'height' => $svg_attrs['height'] + 'x' => $schema['x'], + 'y' => $schema['y'], + 'width' => $schema['width'], + 'height' => $schema['height'] ); break; - case $this->isText(): - return $this->format['box']; - break; case $this->isEllipse(): return array( - 'cx' => $svg_attrs['cx'], - 'cy' => $svg_attrs['cy'], - 'rx' => $svg_attrs['rx'], - 'ry' => $svg_attrs['ry'] + 'cx' => $schema['cx'], + 'cy' => $schema['cy'], + 'rx' => $schema['rx'], + 'ry' => $schema['ry'] ); break; case $this->isLine(): return array( - 'x1' => $svg_attrs['x1'], - 'y1' => $svg_attrs['y1'], - 'x2' => $svg_attrs['x2'], - 'y2' => $svg_attrs['y2'] + 'x1' => $schema['x1'], + 'y1' => $schema['y1'], + 'x2' => $schema['x2'], + 'y2' => $schema['y2'] ); break; } diff --git a/test/unit/Thinreports/Item/BasicItemTest.php b/test/unit/Thinreports/Item/BasicItemTest.php index a5bce2c..d9aec3b 100644 --- a/test/unit/Thinreports/Item/BasicItemTest.php +++ b/test/unit/Thinreports/Item/BasicItemTest.php @@ -15,9 +15,9 @@ function setup() $this->page = $report->addPage(); } - private function newBasicItem($format_data_name) + private function newBasicItem($schema_data_name) { - return new BasicItem($this->page, $this->dataItemFormat($format_data_name)); + return new BasicItem($this->page, $this->dataItemFormat($schema_data_name)); } function test_initialize() @@ -30,8 +30,8 @@ function test_initialize() $this->assertAttributeInstanceOf('Thinreports\Item\Style\TextStyle', 'style', $item); - foreach (array('line', 'rect', 'ellipse') as $format_data_name) { - $item = $this->newBasicItem($format_data_name); + foreach (array('line', 'rect', 'ellipse') as $schema_data_name) { + $item = $this->newBasicItem($schema_data_name); $this->assertAttributeInstanceOf('Thinreports\Item\Style\GraphicStyle', 'style', $item); } @@ -40,53 +40,53 @@ function test_initialize() function test_getBounds() { $item = $this->newBasicItem('image'); - $item_format = $this->dataItemFormat('image'); - $attrs = $item_format['svg']['attrs']; + $item_schema = $this->dataItemFormat('image'); $this->assertEquals(array( - 'x' => $attrs['x'], - 'y' => $attrs['y'], - 'width' => $attrs['width'], - 'height' => $attrs['height'] + 'x' => $item_schema['x'], + 'y' => $item_schema['y'], + 'width' => $item_schema['width'], + 'height' => $item_schema['height'] ), $item->getBounds()); $item = $this->newBasicItem('rect'); - $item_format = $this->dataItemFormat('rect'); - $attrs = $item_format['svg']['attrs']; + $item_schema = $this->dataItemFormat('rect'); $this->assertEquals(array( - 'x' => $attrs['x'], - 'y' => $attrs['y'], - 'width' => $attrs['width'], - 'height' => $attrs['height'] + 'x' => $item_schema['x'], + 'y' => $item_schema['y'], + 'width' => $item_schema['width'], + 'height' => $item_schema['height'] ), $item->getBounds()); $item = $this->newBasicItem('text'); - $item_format = $this->dataItemFormat('text'); - $box = $item_format['box']; + $item_schema = $this->dataItemFormat('text'); - $this->assertEquals($box, $item->getBounds()); + $this->assertEquals(array( + 'x' => $item_schema['x'], + 'y' => $item_schema['y'], + 'width' => $item_schema['width'], + 'height' => $item_schema['height'] + ), $item->getBounds()); $item = $this->newBasicItem('ellipse'); - $item_format = $this->dataItemFormat('ellipse'); - $attrs = $item_format['svg']['attrs']; + $item_schema = $this->dataItemFormat('ellipse'); $this->assertEquals(array( - 'cx' => $attrs['cx'], - 'cy' => $attrs['cy'], - 'rx' => $attrs['rx'], - 'ry' => $attrs['ry'] + 'cx' => $item_schema['cx'], + 'cy' => $item_schema['cy'], + 'rx' => $item_schema['rx'], + 'ry' => $item_schema['ry'] ), $item->getBounds()); $item = $this->newBasicItem('line'); - $item_format = $this->dataItemFormat('line'); - $attrs = $item_format['svg']['attrs']; + $item_schema = $this->dataItemFormat('line'); $this->assertEquals(array( - 'x1' => $attrs['x1'], - 'y1' => $attrs['y1'], - 'x2' => $attrs['x2'], - 'y2' => $attrs['y2'] + 'x1' => $item_schema['x1'], + 'y1' => $item_schema['y1'], + 'x2' => $item_schema['x2'], + 'y2' => $item_schema['y2'] ), $item->getBounds()); } @@ -95,7 +95,7 @@ function test_isTypeOf() $item = $this->newBasicItem('rect'); $this->assertTrue($item->isTypeOf('basic')); - $this->assertTrue($item->isTypeOf('s-rect')); + $this->assertTrue($item->isTypeOf('rect')); } function test_isImage() @@ -138,10 +138,10 @@ function test_isLine() $this->assertFalseIn(array('rect', 'ellipse', 'image', 'text'), 'isLine'); } - private function assertFalseIn($format_data_names, $method_name) + private function assertFalseIn($schema_data_names, $method_name) { - foreach ($format_data_names as $format_data_name) { - $item = $this->newBasicItem($format_data_name); + foreach ($schema_data_names as $schema_data_name) { + $item = $this->newBasicItem($schema_data_name); $this->assertFalse($item->$method_name()); } } diff --git a/test/unit/data/items/ellipse.yml b/test/unit/data/items/ellipse.yml index 100bea3..c1ee6c6 100644 --- a/test/unit/data/items/ellipse.yml +++ b/test/unit/data/items/ellipse.yml @@ -1,16 +1,14 @@ --- default: - type: s-ellipse + type: ellipse id: ellipse_default - display: "true" - svg: - tag: ellipse - attrs: - stroke-width: "1" - stroke-dasharray: none - fill: "#ffffff" - fill-opacity: "1" - rx: "100" - ry: "100" - cx: "200" - cy: "300" + display: true + cx: 200 + cy: 300 + rx: 100 + ry: 100 + style: + border-width: 1 + border-color: #000000 + border-style: solid + fill-color: #ffffff diff --git a/test/unit/data/items/image.yml b/test/unit/data/items/image.yml index 99daae9..471d489 100644 --- a/test/unit/data/items/image.yml +++ b/test/unit/data/items/image.yml @@ -1,13 +1,12 @@ --- default: - type: s-image + type: image id: image_default - display: "true" - svg: - tag: image - attrs: - x: "200" - y: "200" - width: "100" - height: "100" - "xlink:href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVRJREFUeNqkkr9Og1AUxk+5kMBgdCQxId19CJx8AlfnLk3s6oKxYesCK3FzNT6AL4GLm2lcmFmahlwo1/MhNKW0UONJPi45nPPj/LkjpRT9x0ZsOJ9YV7ee935K0ut8fsPHJ+sRBOjN930FKwcEQyxykKvXUE1KSQW3s9lsev8uhCDEIgePLaAsS5KcnOd5L8BgIXYfIPBnALIBgNK0pkrRAhRFQZLJQwDNMAixHQCo38slXY7HvQDEHK3gOQxP2r1lWYcriOOYjl2s+r5U5rpuB6CjAqwoCMLOJgzueza7J8dxKEmSZgZ6C4AKdF2n1Sqj6XRSOReLYFsyvsFM02xm0AIYGq8HQeu1JNu2Kyfeq9Up0QLU98CotoKeWV4URV9pmmZSqioYUupXjW8XwDlnyMVkHNYF65r1wIEvh4bIfd/tuT5YEwDOAW6m+gfDILIfAQYAAm/QA0tCHVUAAAAASUVORK5CYII=" + display: true + x: 200 + y: 200 + width: 100 + height: 100 + data: + mime-type: image/png + base64: iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVRJREFUeNqkkr9Og1AUxk+5kMBgdCQxId19CJx8AlfnLk3s6oKxYesCK3FzNT6AL4GLm2lcmFmahlwo1/MhNKW0UONJPi45nPPj/LkjpRT9x0ZsOJ9YV7ee935K0ut8fsPHJ+sRBOjN930FKwcEQyxykKvXUE1KSQW3s9lsev8uhCDEIgePLaAsS5KcnOd5L8BgIXYfIPBnALIBgNK0pkrRAhRFQZLJQwDNMAixHQCo38slXY7HvQDEHK3gOQxP2r1lWYcriOOYjl2s+r5U5rpuB6CjAqwoCMLOJgzueza7J8dxKEmSZgZ6C4AKdF2n1Sqj6XRSOReLYFsyvsFM02xm0AIYGq8HQeu1JNu2Kyfeq9Up0QLU98CotoKeWV4URV9pmmZSqioYUupXjW8XwDlnyMVkHNYF65r1wIEvh4bIfd/tuT5YEwDOAW6m+gfDILIfAQYAAm/QA0tCHVUAAAAASUVORK5CYII= diff --git a/test/unit/data/items/line.yml b/test/unit/data/items/line.yml index ea82b45..f584eef 100644 --- a/test/unit/data/items/line.yml +++ b/test/unit/data/items/line.yml @@ -1,15 +1,13 @@ --- default: - type: s-line + type: line id: line_default - display: "true" - svg: - tag: line - attrs: - stroke-width: "1" - stroke-dasharray: none - fill: none - x1: "100" - y1: "100" - x2: "200" - y2: "200" + display: true + x1: 100 + y1: 100 + x2: 200 + y2: 200 + style: + border-width: 1 + border-color: #000000 + border-style: solid diff --git a/test/unit/data/items/rect.yml b/test/unit/data/items/rect.yml index ce02d1e..da5e800 100644 --- a/test/unit/data/items/rect.yml +++ b/test/unit/data/items/rect.yml @@ -1,21 +1,19 @@ --- default: &default - type: s-rect + type: rect id: rect_default - display: "true" - svg: - tag: rect - attrs: - stroke-width: "1" - stroke-dasharray: none - fill: "#ffffff" - fill-opacity: "1" - rx: "0" - x: "100" - y: "100" - width: "100" - height: "100" + display: true + x: 100 + y: 100 + width: 100 + height: 100 + border-radius: 0 + style: + border-width: 1 + border-color: #000000 + border-style: solid + fill-color: #ffffff hidden: <<: *default - display: "false" + display: false diff --git a/test/unit/data/items/text.yml b/test/unit/data/items/text.yml index 68513f6..ed5ca5c 100644 --- a/test/unit/data/items/text.yml +++ b/test/unit/data/items/text.yml @@ -1,29 +1,23 @@ --- default: - type: s-text + type: text id: text_default - display: "true" - line-height: "" - line-height-ratio: "" - valign: "" - box: - x: 100 - y: 100 - width: 100 - height: 100 - text: + display: true + x: 100 + y: 100 + width: 100 + height: 100 + texts: - テキスト一行目 - テキスト二行目 - テキスト三行目 - svg: - tag: g - attrs: - fill: "#000000" - kerning: auto - letter-spacing: normal - font-size: "18" - font-family: IPAMincho - font-weight: normal - font-style: normal - text-anchor: start - text-decoration: none + style: + font-family: IPAMincho + font-size: 18 + color: #000000 + font-style: "" + text-align: left + vertical-align: top + line-height: "" + line-height-ratio: "" + letter-spacing: "" From 7cf5cb6d2ba933e2d1cab11816413adf81d28ea3 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Tue, 16 Jan 2018 01:13:33 +0900 Subject: [PATCH 06/11] Support 0.9+ format: ImageBlockItem --- src/Thinreports/Item/ImageBlockItem.php | 8 +++--- .../Thinreports/Item/ImageBlockItemTest.php | 11 ++++++-- test/unit/data/items/image_block.yml | 25 +++++++------------ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Thinreports/Item/ImageBlockItem.php b/src/Thinreports/Item/ImageBlockItem.php index 77a3a8d..019bad2 100644 --- a/src/Thinreports/Item/ImageBlockItem.php +++ b/src/Thinreports/Item/ImageBlockItem.php @@ -14,16 +14,16 @@ class ImageBlockItem extends AbstractBlockItem { - const TYPE_NAME = 's-iblock'; + const TYPE_NAME = 'image-block'; /** * {@inheritdoc} */ - public function __construct(Page $parent, array $format) + public function __construct(Page $parent, array $schema) { - parent::__construct($parent, $format); + parent::__construct($parent, $schema); - $this->style = new BasicStyle($format); + $this->style = new BasicStyle($schema); } /** diff --git a/test/unit/Thinreports/Item/ImageBlockItemTest.php b/test/unit/Thinreports/Item/ImageBlockItemTest.php index 5bae079..74e636c 100644 --- a/test/unit/Thinreports/Item/ImageBlockItemTest.php +++ b/test/unit/Thinreports/Item/ImageBlockItemTest.php @@ -16,8 +16,8 @@ function setup() private function newImageBlock() { - $format = $this->dataItemFormat('image_block', 'default'); - return new ImageBlockItem($this->page, $format); + $schema = $this->dataItemFormat('image_block', 'default'); + return new ImageBlockItem($this->page, $schema); } function test_initialize() @@ -43,4 +43,11 @@ function test_getSource() $test_item->setValue('/path/to/image.png'); $this->assertEquals('/path/to/image.png', $test_item->getSource()); } + + function test_isTypeOf() + { + $test_item = $this->newImageBlock(); + $this->assertTrue($test_item->isTypeOf('image-block')); + $this->assertFalse($test_item->isTypeOf('rect')); + } } diff --git a/test/unit/data/items/image_block.yml b/test/unit/data/items/image_block.yml index b6fc6a5..0fbb3d7 100644 --- a/test/unit/data/items/image_block.yml +++ b/test/unit/data/items/image_block.yml @@ -1,19 +1,12 @@ --- default: - type: s-iblock id: image_block_default - display: "true" - position-x: left - position-y: top - box: - x: 100 - y: 100 - widht: 100 - height: 100 - svg: - tag: image - attrs: - x: "200" - y: "200" - width: "100" - height: "100" + type: image-block + display: true + x: 100 + y: 100 + width: 100 + height: 100 + style: + position-x: left + position-y: top From cb709d4f83abbca33f5065b47a7e62314eb57b80 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Sat, 17 Feb 2018 23:49:40 +0900 Subject: [PATCH 07/11] Add AbstractItem#isDynamic for testing dynamically --- src/Thinreports/Item/AbstractItem.php | 12 ++++++++++++ test/unit/Thinreports/Item/AbstractItemTest.php | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Thinreports/Item/AbstractItem.php b/src/Thinreports/Item/AbstractItem.php index 0194452..300a2af 100644 --- a/src/Thinreports/Item/AbstractItem.php +++ b/src/Thinreports/Item/AbstractItem.php @@ -17,6 +17,7 @@ abstract class AbstractItem protected $schema; protected $is_visible; + protected $is_dynamic; protected $style; /** @@ -28,6 +29,7 @@ public function __construct(Page $parent, array $schema) $this->parent = $parent; $this->schema = $schema; $this->is_visible = $schema['display'] === true; + $this->is_dynamic = $schema['id'] !== ''; } /** @@ -125,6 +127,16 @@ public function __clone() $this->style = clone $this->style; } + /** + * @access private + * + * @return boolean + */ + public function isDynamic() + { + return $this->is_dynamic; + } + /** * @access private * diff --git a/test/unit/Thinreports/Item/AbstractItemTest.php b/test/unit/Thinreports/Item/AbstractItemTest.php index 16dd9b6..6bf6281 100644 --- a/test/unit/Thinreports/Item/AbstractItemTest.php +++ b/test/unit/Thinreports/Item/AbstractItemTest.php @@ -107,6 +107,15 @@ function test_getParent() $this->assertSame($this->page, $item->getParent()); } + function test_getIsDynamic() + { + $item = new TestItem($this->page, array('id' => '', 'display' => true)); + $this->assertFalse($item->isDynamic()); + + $item = new TestItem($this->page, array('id' => 'foo', 'display' => true)); + $this->assertTrue($item->isDynamic()); + } + function test_getSchema() { $schema = array('display' => true); From 386f186aa374b991da724e3b05f1c0bfacc0d0ec Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Sun, 18 Feb 2018 00:58:52 +0900 Subject: [PATCH 08/11] Fixed test --- test/unit/Thinreports/Item/AbstractItemTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/Thinreports/Item/AbstractItemTest.php b/test/unit/Thinreports/Item/AbstractItemTest.php index 6bf6281..cc66430 100644 --- a/test/unit/Thinreports/Item/AbstractItemTest.php +++ b/test/unit/Thinreports/Item/AbstractItemTest.php @@ -75,13 +75,13 @@ function test_setStyle() $item = new TestGraphicsItem($this->page, $this->dataItemFormat('rect')); $item->setStyle('fill_color', 'red'); - $this->assertEquals('red', $item->getStyle('fill_color')); + $this->assertEquals('red', $item->style->get_fill_color()); } function test_getStyle() { $item = new TestGraphicsItem($this->page, $this->dataItemFormat('rect')); - $this->assertEquals('#ffffff', $item->style->get_fill_color()); + $this->assertEquals('#ffffff', $item->getStyle('fill_color')); } function test_setStyles() @@ -136,7 +136,7 @@ function test_getId() function test_isTypeOf() { $item = new TestItem($this->page, array( - 'display' => 'true', + 'display' => true, 'type' => 'foo_type' )); $this->assertTrue($item->isTypeOf('foo_type')); From 00c1d1afd243873d74452f1998f25630aea5f73a Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Sun, 18 Feb 2018 01:33:18 +0900 Subject: [PATCH 09/11] Support 0.9+ format: PageNumberItem --- src/Thinreports/Item/PageNumberItem.php | 52 ++++++++++--------- .../Thinreports/Item/PageNumberItemTest.php | 23 +++----- test/unit/data/items/page_number.yml | 45 +++++++--------- 3 files changed, 55 insertions(+), 65 deletions(-) diff --git a/src/Thinreports/Item/PageNumberItem.php b/src/Thinreports/Item/PageNumberItem.php index 77ccfb2..2e96b3a 100644 --- a/src/Thinreports/Item/PageNumberItem.php +++ b/src/Thinreports/Item/PageNumberItem.php @@ -14,31 +14,22 @@ class PageNumberItem extends AbstractItem { - const TYPE_NAME = 's-pageno'; - - static protected $serial_number = 1; + const TYPE_NAME = 'page-number'; private $number_format; - /** - * @access private - * - * @return string - */ - static public function generateUniqueId() - { - return '__page_no_' . self::$serial_number++ . '__'; - } - /** * {@inheritdoc} */ - public function __construct(Page $parent, array $format) + public function __construct(Page $parent, array $schema) { - parent::__construct($parent, $format); + parent::__construct($parent, $schema); + + # PageNumberItem is Always dynamically item + $this->is_dynamic = true; - $this->style = new TextStyle($format); - $this->number_format = $this->format['format']; + $this->style = new TextStyle($schema); + $this->number_format = $this->schema['format']; } /** @@ -56,7 +47,7 @@ public function setNumberFormat($new_format) */ public function resetNumberFormat() { - $this->setNumberFormat($this->format['format']); + $this->setNumberFormat($this->schema['format']); return $this; } @@ -75,18 +66,24 @@ public function getNumberFormat() */ public function getFormattedPageNumber() { + if (!$this->isForReport()) { + return ''; + } + $format = $this->getNumberFormat(); - if ($format === '' || !$this->isForReport()) { + if ($format === '') { return ''; } - $page = $this->getParent(); + $page = $this->getParent(); $report = $page->getReport(); - return str_replace(array('{page}', '{total}'), - array($page->getNo(), $report->getLastPageNumber()), - $format); + return str_replace( + array('{page}', '{total}'), + array($page->getNo(), $report->getLastPageNumber()), + $format + ); } /** @@ -96,7 +93,7 @@ public function getFormattedPageNumber() */ public function isForReport() { - return empty($this->format['target']); + return $this->schema['target'] === '' || $this->schema['target'] === 'report'; } /** @@ -104,6 +101,11 @@ public function isForReport() */ public function getBounds() { - return $this->format['box']; + return array( + 'x' => $this->schema['x'], + 'y' => $this->schema['y'], + 'width' => $this->schema['width'], + 'height' => $this->schema['height'] + ); } } diff --git a/test/unit/Thinreports/Item/PageNumberItemTest.php b/test/unit/Thinreports/Item/PageNumberItemTest.php index daef31e..3cdb970 100644 --- a/test/unit/Thinreports/Item/PageNumberItemTest.php +++ b/test/unit/Thinreports/Item/PageNumberItemTest.php @@ -18,19 +18,8 @@ function setup() private function newPageNumber($data_format_key) { - $format = $this->dataItemFormat('page_number', $data_format_key); - return new PageNumberItem($this->page, $format); - } - - function test_generateUniqueId() - { - $id = PageNumberItem::generateUniqueId(); - - $this->assertTrue(preg_match('/^__page_no_(\d+?)__$/', $id, $matches) === 1); - - $id = PageNumberItem::generateUniqueId(); - - $this->assertEquals('__page_no_' . ($matches[1] + 1) . '__', $id); + $schema = $this->dataItemFormat('page_number', $data_format_key); + return new PageNumberItem($this->page, $schema); } function test_initialize() @@ -40,6 +29,7 @@ function test_initialize() $this->assertAttributeInstanceOf('Thinreports\Item\Style\TextStyle', 'style', $test_item); $this->assertAttributeEquals('{page}', 'number_format', $test_item); + $this->assertAttributeEquals(true, 'is_dynamic', $test_item); } function test_setNumberFormat() @@ -78,7 +68,7 @@ function test_getFormattedPageNumber() $this->assertSame('', $test_item->getFormattedPageNumber()); - $test_item = $this->newPageNumber('with_for_list'); + $test_item = $this->newPageNumber('target_list'); $this->assertSame('', $test_item->getFormattedPageNumber()); @@ -96,7 +86,10 @@ function test_isForReport() $test_item = $this->newPageNumber('default'); $this->assertTrue($test_item->isForReport()); - $test_item = $this->newPageNumber('with_for_list'); + $test_item = $this->newPageNumber('target_blank'); + $this->assertTrue($test_item->isForReport()); + + $test_item = $this->newPageNumber('target_list'); $this->assertFalse($test_item->isForReport()); } diff --git a/test/unit/data/items/page_number.yml b/test/unit/data/items/page_number.yml index 93cf315..197845f 100644 --- a/test/unit/data/items/page_number.yml +++ b/test/unit/data/items/page_number.yml @@ -1,32 +1,27 @@ --- default: &default - type: s-pageno - id: __page_no_1__ - display: "true" - box: - x: 100 - y: 100 - width: 100 - height: 100 + type: page-number + id: "" + x: 100 + y: 100 + width: 100 + height: 100 format: "{page}" - overflow: truncate + target: report + display: true + style: + font-family: Helvetica + font-size: 18 + color: #000000 + font-style: [] + text-align: left + letter-spacing: "" + overflow: truncate + +target_blank: + <<: *default target: "" - svg: - tag: text - attrs: - x: "200" - y: "200" - kerning: auto - letter-spacing: normal - fill: "#000000" - font-size: "18" - font-family: Helvetica - font-weight: normal - font-style: normal - text-anchor: middle - text-decoration: none -with_for_list: +target_list: <<: *default - id: __page_no_2__ target: list From 61b558e8b738ff56802e42453f391b4849173605 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Thu, 22 Feb 2018 16:07:18 +0900 Subject: [PATCH 10/11] Support 0.9+ format: TextBlockItem --- src/Thinreports/Item/TextBlockItem.php | 20 +++---- .../Thinreports/Item/TextBlockItemTest.php | 7 +-- test/unit/data/items/text_block.yml | 53 +++++++++---------- 3 files changed, 36 insertions(+), 44 deletions(-) diff --git a/src/Thinreports/Item/TextBlockItem.php b/src/Thinreports/Item/TextBlockItem.php index 9291f0e..9145ffc 100644 --- a/src/Thinreports/Item/TextBlockItem.php +++ b/src/Thinreports/Item/TextBlockItem.php @@ -16,7 +16,7 @@ class TextBlockItem extends AbstractBlockItem { - const TYPE_NAME = 's-tblock'; + const TYPE_NAME = 'text-block'; private $format_enabled = null; private $reference_item = null; @@ -25,19 +25,19 @@ class TextBlockItem extends AbstractBlockItem /** * {@inheritdoc} */ - public function __construct(Page $parent, array $format) + public function __construct(Page $parent, array $schema) { - parent::__construct($parent, $format); + parent::__construct($parent, $schema); - $this->style = new TextStyle($format); - $this->formatter = new TextFormatter($format['format']); + $this->style = new TextStyle($schema); + $this->formatter = new TextFormatter($schema['format']); $this->format_enabled = $this->hasFormatSettings(); - parent::setValue($format['value']); + parent::setValue($schema['value']); if ($this->hasReference()) { - $this->reference_item = $parent->item($format['ref-id']); + $this->reference_item = $parent->item($schema['reference-id']); } } @@ -117,7 +117,7 @@ public function getRealValue() */ public function isMultiple() { - return $this->format['multiple'] === 'true'; + return $this->schema['multiple-line'] === true; } /** @@ -127,7 +127,7 @@ public function isMultiple() */ public function hasFormatSettings() { - $text_format = $this->format['format']; + $text_format = $this->schema['format']; return $text_format['type'] !== '' || $text_format['base'] !== ''; } @@ -138,6 +138,6 @@ public function hasFormatSettings() */ public function hasReference() { - return $this->format['ref-id'] !== ''; + return $this->schema['reference-id'] !== ''; } } diff --git a/test/unit/Thinreports/Item/TextBlockItemTest.php b/test/unit/Thinreports/Item/TextBlockItemTest.php index 3930227..b30a52d 100644 --- a/test/unit/Thinreports/Item/TextBlockItemTest.php +++ b/test/unit/Thinreports/Item/TextBlockItemTest.php @@ -17,12 +17,9 @@ function setup() $layout_filename = $this->dataLayoutFile('empty_A4P.tlf'); $report = new Report($layout_filename); - $layout = new Layout($layout_filename, array( - 'format' => array('svg' => ''), - 'item_formats' => $text_block_formats - )); + $layout = new Layout(array('items' => $text_block_formats), 'identifier'); - $this->page= new Page($report, $layout, 1); + $this->page = new Page($report, $layout, 1); } private function newTextBlock($data_format_key) diff --git a/test/unit/data/items/text_block.yml b/test/unit/data/items/text_block.yml index 374d889..6206850 100644 --- a/test/unit/data/items/text_block.yml +++ b/test/unit/data/items/text_block.yml @@ -1,41 +1,36 @@ --- default: &default - type: s-tblock id: text_block_default + type: text-block value: "" - ref-id: "" - display: "true" - multiple: "false" - line-height: "" - line-height-ratio: "" - valign: top - overflow: truncate - word-wrap: break-word - box: - x: 100 - y: 100 - width: 100 - height: 100 + reference-id: "" + x: 100 + y: 100 + width: 100 + height: 100 + display: true + value: "" + multiple-line: false format: base: "" type: "" - svg: - tag: text - attrs: - kerning: auto - letter-spacing: normal - fill: "#000000" - font-size: 18 - font-family: Helvetica - font-weight: normal - font-style: normal - text-anchor: start - text-decoration: none + style: + font-family: Helvetica + font-size: 18 + color: #000000 + font-style: "" + text-align: left + vertical-align: top + line-height: "" + line-height-ratio: "" + letter-spacing: "" + overflow: truncate + word-wrap: break-word with_multiple: <<: *default id: text_block_multiple - multiple: "true" + multiple-line: true with_default_value: <<: *default @@ -62,9 +57,9 @@ with_base_formatting: with_reference_to_default: <<: *default id: text_block_reference_to_default - ref-id: text_block_default + reference-id: text_block_default with_reference_to_formatting: <<: *default id: text_block_reference_to_number_formatting - ref-id: text_block_number_formatting + reference-id: text_block_number_formatting From 3342306d1e80acdf2bd4492555e06ccda2745138 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Sun, 25 Feb 2018 04:00:46 +0900 Subject: [PATCH 11/11] Support 0.9+ format: Style --- src/Thinreports/Item/PageNumberItem.php | 2 +- src/Thinreports/Item/Style/BasicStyle.php | 17 +- src/Thinreports/Item/Style/GraphicStyle.php | 19 +- src/Thinreports/Item/Style/TextStyle.php | 140 +++++--------- src/Thinreports/Item/TextBlockItem.php | 2 +- .../Thinreports/Item/Style/BasicStyleTest.php | 9 +- .../Item/Style/GraphicStyleTest.php | 70 +++---- .../Thinreports/Item/Style/TextStyleTest.php | 183 +++++++----------- 8 files changed, 163 insertions(+), 279 deletions(-) diff --git a/src/Thinreports/Item/PageNumberItem.php b/src/Thinreports/Item/PageNumberItem.php index 2e96b3a..1090eef 100644 --- a/src/Thinreports/Item/PageNumberItem.php +++ b/src/Thinreports/Item/PageNumberItem.php @@ -28,7 +28,7 @@ public function __construct(Page $parent, array $schema) # PageNumberItem is Always dynamically item $this->is_dynamic = true; - $this->style = new TextStyle($schema); + $this->style = new TextStyle($schema['style']); $this->number_format = $this->schema['format']; } diff --git a/src/Thinreports/Item/Style/BasicStyle.php b/src/Thinreports/Item/Style/BasicStyle.php index 05c4ec9..d721658 100644 --- a/src/Thinreports/Item/Style/BasicStyle.php +++ b/src/Thinreports/Item/Style/BasicStyle.php @@ -17,14 +17,15 @@ class BasicStyle { static protected $available_style_names = array(); - protected $styles = array(); + + protected $styles; /** - * @param array $item_format + * @param array $item_styles */ - public function __construct(array $item_format) + public function __construct(array $item_styles) { - $this->initializeStyles($item_format); + $this->styles = $item_styles; } /** @@ -95,12 +96,4 @@ public function verifyStyleValue($style_name, $value, array $allows) throw new Exception\UnavailableStyleValue($style_name, $value, $allows); } } - - /** - * @param array $item_format - */ - protected function initializeStyles(array $item_format) - { - $this->styles = $item_format['svg']['attrs'] ?: array(); - } } diff --git a/src/Thinreports/Item/Style/GraphicStyle.php b/src/Thinreports/Item/Style/GraphicStyle.php index faea8bf..a5c9cb4 100644 --- a/src/Thinreports/Item/Style/GraphicStyle.php +++ b/src/Thinreports/Item/Style/GraphicStyle.php @@ -22,22 +22,19 @@ class GraphicStyle extends BasicStyle ); /** - * @param float|string $width + * @param float|integer $width */ public function set_border_width($width) { - if ((float) $width > 0) { - $this->styles['stroke-opacity'] = '1'; - } - $this->styles['stroke-width'] = $width; + $this->styles['border-width'] = $width; } /** - * @return float|string + * @return float|integer */ public function get_border_width() { - return $this->readStyle('stroke-width'); + return $this->readStyle('border-width'); } /** @@ -45,7 +42,7 @@ public function get_border_width() */ public function set_border_color($color) { - $this->styles['stroke'] = $color; + $this->styles['border-color'] = $color; } /** @@ -53,7 +50,7 @@ public function set_border_color($color) */ public function get_border_color() { - return $this->readStyle('stroke'); + return $this->readStyle('border-color'); } /** @@ -80,7 +77,7 @@ public function get_border() */ public function set_fill_color($color) { - $this->styles['fill'] = $color; + $this->styles['fill-color'] = $color; } /** @@ -88,6 +85,6 @@ public function set_fill_color($color) */ public function get_fill_color() { - return $this->readStyle('fill'); + return $this->readStyle('fill-color'); } } diff --git a/src/Thinreports/Item/Style/TextStyle.php b/src/Thinreports/Item/Style/TextStyle.php index ba8dba0..4a2695a 100644 --- a/src/Thinreports/Item/Style/TextStyle.php +++ b/src/Thinreports/Item/Style/TextStyle.php @@ -21,36 +21,12 @@ class TextStyle extends BasicStyle 'align', 'valign', 'color', 'font_size' ); - static private $text_alignments = array( - 'left' => 'start', - 'center' => 'middle', - 'right' => 'end' - ); - - static private $vertical_alignments = array( - 'top', 'center', 'bottom' - ) ; - - private $vertical_align = 'top'; - - /** - * {@inheritdoc} - */ - protected function initializeStyles(array $item_format) - { - parent::initializeStyles($item_format); - - if (!empty($item_format['valign'])) { - $this->vertical_align = $item_format['valign']; - } - } - /** * @param string $color */ public function set_color($color) { - $this->styles['fill'] = $color; + $this->styles['color'] = $color; } /** @@ -58,11 +34,11 @@ public function set_color($color) */ public function get_color() { - return $this->readStyle('fill'); + return $this->readStyle('color'); } /** - * @param float|string + * @param float|integer $size */ public function set_font_size($size) { @@ -70,7 +46,7 @@ public function set_font_size($size) } /** - * @return float|string + * @return float|integer */ public function get_font_size() { @@ -82,7 +58,7 @@ public function get_font_size() */ public function set_bold($enable) { - $this->styles['font-weight'] = $enable ? 'bold' : 'normal'; + $this->updateFontStyle('bold', $enable); } /** @@ -90,7 +66,7 @@ public function set_bold($enable) */ public function get_bold() { - return $this->readStyle('font-weight') === 'bold'; + return $this->hasFontStyle('bold'); } /** @@ -98,7 +74,7 @@ public function get_bold() */ public function set_italic($enable) { - $this->styles['font-style'] = $enable ? 'italic' : 'normal'; + $this->updateFontStyle('italic', $enable); } /** @@ -106,7 +82,7 @@ public function set_italic($enable) */ public function get_italic() { - return $this->readStyle('font-style') === 'italic'; + return $this->hasFontStyle('italic'); } /** @@ -114,7 +90,7 @@ public function get_italic() */ public function set_underline($enable) { - $this->setTextDecoration($enable, null); + $this->updateFontStyle('underline', $enable); } /** @@ -122,7 +98,7 @@ public function set_underline($enable) */ public function get_underline() { - return $this->hasTextDecoration('underline'); + return $this->hasFontStyle('underline'); } /** @@ -130,7 +106,7 @@ public function get_underline() */ public function set_linethrough($enable) { - $this->setTextDecoration(null, $enable); + $this->updateFontStyle('linethrough', $enable); } /** @@ -138,97 +114,85 @@ public function set_linethrough($enable) */ public function get_linethrough() { - return $this->hasTextDecoration('line-through'); + return $this->hasFontStyle('linethrough'); } /** - * @param string $alignment {@see TextStyle::$text_alignments} + * @param string $alignment */ public function set_align($alignment) { - $this->verifyStyleValue('align', $alignment, array_keys(self::$text_alignments)); - $this->styles['text-anchor'] = self::$text_alignments[$alignment]; + $this->verifyStyleValue('align', $alignment, array('left', 'center', 'right')); + $this->styles['text-align'] = $alignment; } /** - * @return string {@see TextStyle::$text_alignments} - * @throws Exception\UnavailableStyleValue + * @return string */ public function get_align() { - $alignment_value = $this->readStyle('text-anchor'); - - if (empty($alignment_value)) { - return 'left'; - } - - $alignment_key = array_search($alignment_value, self::$text_alignments); - - if (!$alignment_key) { - throw new Exception\UnavailableStyleValue( - 'align', $alignment_value, array_keys(self::$text_alignments)); - } - return $alignment_key; + $alignment = $this->readStyle('text-align'); + return $alignment === '' ? 'left' : $alignment; } /** - * @param string $alignment {@see TextStyle::$vertical_alignments} + * @param string $alignment */ public function set_valign($alignment) { - $this->verifyStyleValue('valign', $alignment, self::$vertical_alignments); - $this->vertical_align = $alignment; + $this->verifyStyleValue('valign', $alignment, array('top', 'middle', 'bottom')); + $this->styles['vertical-align'] = $alignment; } /** - * @return string {@see TextStyle::$vertical_alignments} + * @return string */ public function get_valign() { - return $this->vertical_align; + $alignment = $this->readStyle('vertical-align'); + return $alignment === '' ? 'top' : $alignment; } /** - * @param boolean $underline = null - * @param boolean $linethrough = null + * @param string $type Availables are "bold", "italic", "underline", "linethrough" + * @param boolean $enable */ - private function setTextDecoration($underline = null, $linethrough = null) + private function updateFontStyle($type, $enable) { - $decorations = array(); - - if ($underline === null) { - $underline = $this->get_underline(); - } - if ($linethrough === null) { - $linethrough = $this->get_linethrough(); + if ($enable) { + $this->enableFontStyle($type); + } else { + $this->disableFontStyle($type); } + } - if ($underline || $linethrough) { - if ($underline) { - $decorations[] = 'underline'; - } - if ($linethrough) { - $decorations[] = 'line-through'; - } - } else { - $decorations[] = 'none'; + /** + * @param string $type {@see self::updateFontStyle()} + */ + private function enableFontStyle($type) + { + if (!$this->hasFontStyle($type)) { + array_push($this->styles['font-style'], $type); } + } - $this->styles['text-decoration'] = implode(' ', $decorations); + /** + * @param string $type {@see self::updateFontStyle()} + */ + private function disableFontStyle($type) + { + if ($this->hasFontStyle($type)) { + $index = array_search($type, $this->styles['font-style']); + array_splice($this->styles['font-style'], $index, 1); + } } /** - * @param string|null $decoration_name + * @param string $type {@see self::updateFontStyle()} * @return boolean */ - private function hasTextDecoration($decoration_name) + private function hasFontStyle($type) { - $decoration = $this->readStyle('text-decoration'); - - if (!empty($decoration)) { - return in_array($decoration_name, explode(' ', $decoration), true); - } else { - return false; - } + return array_search($type, $this->styles['font-style']) !== false; } } diff --git a/src/Thinreports/Item/TextBlockItem.php b/src/Thinreports/Item/TextBlockItem.php index 9145ffc..d7c925e 100644 --- a/src/Thinreports/Item/TextBlockItem.php +++ b/src/Thinreports/Item/TextBlockItem.php @@ -29,7 +29,7 @@ public function __construct(Page $parent, array $schema) { parent::__construct($parent, $schema); - $this->style = new TextStyle($schema); + $this->style = new TextStyle($schema['style']); $this->formatter = new TextFormatter($schema['format']); $this->format_enabled = $this->hasFormatSettings(); diff --git a/test/unit/Thinreports/Item/Style/BasicStyleTest.php b/test/unit/Thinreports/Item/Style/BasicStyleTest.php index aac5329..ed8b32c 100644 --- a/test/unit/Thinreports/Item/Style/BasicStyleTest.php +++ b/test/unit/Thinreports/Item/Style/BasicStyleTest.php @@ -26,14 +26,7 @@ class BasicStyleTest extends TestCase function setup() { - $item_format = array( - 'svg' => array( - 'attrs' => array( - 'style_a' => 'style_a_value', - ) - ) - ); - $this->test_style = new TestStyle($item_format); + $this->test_style = new TestStyle(array('style_a' => 'style_a_value')); } function test_initialize() diff --git a/test/unit/Thinreports/Item/Style/GraphicStyleTest.php b/test/unit/Thinreports/Item/Style/GraphicStyleTest.php index e1d55b9..87ba274 100644 --- a/test/unit/Thinreports/Item/Style/GraphicStyleTest.php +++ b/test/unit/Thinreports/Item/Style/GraphicStyleTest.php @@ -5,11 +5,6 @@ class GraphicStyleTest extends TestCase { - private function newGraphicStyle(array $svg_attrs = array()) - { - return new GraphicStyle(array('svg' => array('attrs' => $svg_attrs))); - } - function test_available_style_names() { $this->assertAttributeEquals( @@ -20,80 +15,61 @@ function test_available_style_names() function test_set_border_width() { - foreach (array(null, '0', 0) as $width) { - $test_style = $this->newGraphicStyle(array( - 'stroke-opacity' => '1', - 'stroke-width' => '1' - )); - $test_style->set_border_width($width); - - $styles = $test_style->export(); - - $this->assertEquals('1', $styles['stroke-opacity']); - $this->assertSame($width, $styles['stroke-width']); - } + $test_style = new GraphicStyle(array('border-width' => 1)); + $test_style->set_border_width(999.9); + + $this->assertAttributeEquals(array('border-width' => 999.9), 'styles', $test_style); } function test_get_border_width() { - $test_style = $this->newGraphicStyle(array('stroke-width' => '5')); - $this->assertEquals('5', $test_style->get_border_width()); + $test_style = new GraphicStyle(array('border-width' => 999)); - $test_style = $this->newGraphicStyle(array()); - $this->assertNull($test_style->get_border_width()); + $this->assertEquals(999, $test_style->get_border_width()); } function test_set_border_color() { - $test_style = $this->newGraphicStyle(array('stroke' => 'red')); + $test_style = new GraphicStyle(array('border-color' => 'none')); + $test_style->set_border_color('#000000'); - $test_style->set_border_color('#ff0000'); - - $styles = $test_style->export(); - $this->assertEquals('#ff0000', $styles['stroke']); + $this->assertAttributeEquals(array('border-color' => '#000000'), 'styles', $test_style); } function test_get_border_color() { - $test_style = $this->newGraphicStyle(array('stroke' => '#0000ff')); - $this->assertEquals('#0000ff', $test_style->get_border_color()); + $test_style = new GraphicStyle(array('border-color' => 'red')); + + $this->assertEquals('red', $test_style->get_border_color()); } function test_set_border() { - $test_style = $this->newGraphicStyle(array( - 'stroke-width' => '1', - 'stroke' => '#000000' - )); - $test_style->set_border(array(1, 'red')); - - $styles = $test_style->export(); - $this->assertEquals(1, $styles['stroke-width']); - $this->assertEquals('red', $styles['stroke']); + $test_style = new GraphicStyle(array('border-color' => 'none', 'border-width' => 1)); + $test_style->set_border(array(9, '#ffffff')); + + $this->assertAttributeEquals(array('border-color' => '#ffffff', 'border-width' => 9), 'styles', $test_style); } function test_get_border() { - $test_style = $this->newGraphicStyle(array( - 'stroke-width' => '3', - 'stroke' => 'blue' - )); + $test_style = new GraphicStyle(array('border-color' => 'none', 'border-width' => 1.0)); - $this->assertEquals(array('3', 'blue'), $test_style->get_border()); + $this->assertEquals(array(1.0, 'none'), $test_style->get_border()); } function test_set_fill_color() { - $test_style = $this->newGraphicStyle(array('fill' => '#000000')); - $test_style->set_fill_color('red'); + $test_style = new GraphicStyle(array('fill-color' => 'none')); + $test_style->set_fill_color('#000000'); - $styles = $test_style->export(); - $this->assertEquals('red', $styles['fill']); + $this->assertAttributeEquals(array('fill-color' => '#000000'), 'styles', $test_style); } function test_get_fill_color() { - $test_style = $this->newGraphicStyle(array('fill' => 'blue')); + $test_style = new GraphicStyle(array('fill-color' => 'blue')); + $this->assertEquals('blue', $test_style->get_fill_color()); } } diff --git a/test/unit/Thinreports/Item/Style/TextStyleTest.php b/test/unit/Thinreports/Item/Style/TextStyleTest.php index 815bebd..fcada6f 100644 --- a/test/unit/Thinreports/Item/Style/TextStyleTest.php +++ b/test/unit/Thinreports/Item/Style/TextStyleTest.php @@ -6,14 +6,6 @@ class TextStyleTest extends TestCase { - private function newTextStyle($valign = null, array $svg_attrs = array()) - { - return new TextStyle(array( - 'valign' => $valign, - 'svg' => array('attrs' => $svg_attrs) - )); - } - function test_available_style_names() { $this->assertAttributeEquals( @@ -25,145 +17,123 @@ function test_available_style_names() ); } - function test_initialize() - { - $test_style = $this->newTextStyle(''); - $this->assertAttributeEquals('top', 'vertical_align', $test_style); - - $test_style = $this->newTextStyle('bottom'); - $this->assertAttributeEquals('bottom', 'vertical_align', $test_style); - } - function test_set_color() { - $test_style = $this->newTextStyle(null, array('fill' => 'red')); + $test_style = new TextStyle(array('color' => 'none')); $test_style->set_color('#ff0000'); - $styles = $test_style->export(); - $this->assertEquals('#ff0000', $styles['fill']); + $this->assertAttributeEquals(array('color' => '#ff0000'), 'styles', $test_style); } function test_get_color() { - $test_style = $this->newTextStyle(null, array('fill' => 'blue')); - $this->assertEquals('blue', $test_style->get_color()); + $test_style = new TextStyle(array('color' => 'none')); + + $this->assertEquals('none', $test_style->get_color()); } function test_set_font_size() { - $test_style = $this->newTextStyle(null, array('font-size' => '18')); - $test_style->set_font_size(20); + $test_style = new TextStyle(array('font-size' => 1)); + $test_style->set_font_size(15.0); - $styles = $test_style->export(); - $this->assertEquals(20, $styles['font-size']); + $this->assertAttributeEquals(array('font-size' => 15.0), 'styles', $test_style); } function test_get_font_size() { - $test_style = $this->newTextStyle(null, array('font-size' => '12')); - $this->assertEquals('12', $test_style->get_font_size()); + $test_style = new TextStyle(array('font-size' => 18.0)); + + $this->assertEquals(18.0, $test_style->get_font_size()); } - /** - * Tests for: - * TextStyle::set_bold - * TextStyle::get_bold - */ - function test_bold() + function test_set_bold() { - $test_style = $this->newTextStyle(null, array('font-weight' => 'normal')); - $this->assertFalse($test_style->get_bold()); - + $test_style = new TextStyle(array('font-style' => array('italic'))); $test_style->set_bold(true); - $styles = $test_style->export(); - $this->assertEquals('bold', $styles['font-weight']); - $this->assertTrue($test_style->get_bold()); + $this->assertAttributeEquals(array('font-style' => array('italic', 'bold')), 'styles', $test_style); $test_style->set_bold(false); - $styles = $test_style->export(); - $this->assertEquals('normal', $styles['font-weight']); - $this->assertFalse($test_style->get_bold()); + $this->assertAttributeEquals(array('font-style' => array('italic')), 'styles', $test_style); } - function test_italic() + function test_get_bold() { - $test_style =$this->newTextStyle(null, array('font-style' => 'normal')); - $this->assertFalse($test_style->get_italic()); + $test_style = new TextStyle(array('font-style' => array('bold'))); + $this->assertTrue($test_style->get_bold()); + + $test_style = new TextStyle(array('font-style' => array())); + $this->assertFalse($test_style->get_bold()); + } + function test_set_italic() + { + $test_style = new TextStyle(array('font-style' => array())); $test_style->set_italic(true); - $styles = $test_style->export(); - $this->assertEquals('italic', $styles['font-style']); - $this->assertTrue($test_style->get_italic()); + $this->assertAttributeEquals(array('font-style' => array('italic')), 'styles', $test_style); $test_style->set_italic(false); - $styles = $test_style->export(); - $this->assertEquals('normal', $styles['font-style']); - $this->assertFalse($test_style->get_italic()); + $this->assertAttributeEquals(array('font-style' => array()), 'styles', $test_style); } - function test_underline() + function test_get_italic() { - $test_style = $this->newTextStyle(null, - array('text-decoration' => 'underline')); - $this->assertTrue($test_style->get_underline()); + $test_style = new TextStyle(array('font-style' => array('bold', 'italic'))); + $this->assertTrue($test_style->get_italic()); - $test_style->set_underline(false); + $test_style = new TextStyle(array('font-style' => array('bold'))); + $this->assertFalse($test_style->get_italic()); + } - $styles = $test_style->export(); - $this->assertEquals('none', $styles['text-decoration']); - $this->assertFalse($test_style->get_underline()); + function test_set_underline() + { + $test_style = new TextStyle(array('font-style' => array('bold'))); + $test_style->set_underline(true); - $test_style = $this->newTextStyle(null, - array('text-decoration' => 'line-through underline')); - $this->assertTrue($test_style->get_underline()); + $this->assertAttributeEquals(array('font-style' => array('bold', 'underline')), 'styles', $test_style); $test_style->set_underline(false); - $styles = $test_style->export(); - $this->assertEquals('line-through', $styles['text-decoration']); - $this->assertFalse($test_style->get_underline()); - - $test_style = $this->newTextStyle(null, - array('text-decoration' => 'line-through')); - $this->assertFalse($test_style->get_underline()); - - $test_style->set_underline(true); + $this->assertAttributeEquals(array('font-style' => array('bold')), 'styles', $test_style); + } - $styles = $test_style->export(); - $this->assertEquals('underline line-through', $styles['text-decoration']); + function test_get_underline() + { + $test_style = new TextStyle(array('font-style' => array('underline'))); $this->assertTrue($test_style->get_underline()); - $test_style = $this->newTextStyle(null, - array('text-decoration' => 'none')); + $test_style = new TextStyle(array('font-style' => array())); $this->assertFalse($test_style->get_underline()); + } - $test_style->set_underline(true); + function test_set_linethrough() + { + $test_style = new TextStyle(array('font-style' => array('bold'))); + $test_style->set_linethrough(true); - $styles = $test_style->export(); - $this->assertEquals('underline', $styles['text-decoration']); - $this->assertTrue($test_style->get_underline()); + $this->assertAttributeEquals(array('font-style' => array('bold', 'linethrough')), 'styles', $test_style); + + $test_style->set_linethrough(false); + + $this->assertAttributeEquals(array('font-style' => array('bold')), 'styles', $test_style); } - function test_linethrough() + function test_get_linethrough() { - $test_style = $this->newTextStyle(null, - array('text-decoration' => 'line-through')); + $test_style = new TextStyle(array('font-style' => array('linethrough'))); $this->assertTrue($test_style->get_linethrough()); - $test_style->set_linethrough(false); - - $styles = $test_style->export(); + $test_style = new TextStyle(array('font-style' => array())); $this->assertFalse($test_style->get_linethrough()); - $this->assertEquals('none', $styles['text-decoration']); } function test_set_align() { - $test_style = $this->newTextStyle(null, array('text-anchor' => 'start')); + $test_style = new TextStyle(array('text-align' => '')); try { $test_style->set_align('unavailable_value'); @@ -172,40 +142,25 @@ function test_set_align() // OK } - $test_style->set_align('left'); - - $styles = $test_style->export(); - $this->assertEquals('start', $styles['text-anchor']); - - $test_style->set_align('center'); - - $styles = $test_style->export(); - $this->assertEquals('middle', $styles['text-anchor']); - $test_style->set_align('right'); - $styles = $test_style->export(); - $this->assertEquals('end', $styles['text-anchor']); + $this->assertAttributeEquals(array('text-align' => 'right'), 'styles', $test_style); } function test_get_align() { - $test_style = $this->newTextStyle(null, array('text-anchor' => '')); - $this->assertEquals('left', $test_style->get_align()); + $test_style = new TextStyle(array('text-align' => '')); - $test_style = $this->newTextStyle(null, array('text-anchor' => 'start')); $this->assertEquals('left', $test_style->get_align()); - $test_style = $this->newTextStyle(null, array('text-anchor' => 'middle')); - $this->assertEquals('center', $test_style->get_align()); + $test_style = new TextStyle(array('text-align' => 'right')); - $test_style = $this->newTextStyle(null, array('text-anchor' => 'end')); $this->assertEquals('right', $test_style->get_align()); } function test_set_valign() { - $test_style = $this->newTextStyle('top'); + $test_style = new TextStyle(array('vertical-align' => '')); try { $test_style->set_valign('unavailable_value'); @@ -214,13 +169,19 @@ function test_set_valign() // OK } - $test_style->set_valign('bottom'); - $this->assertAttributeEquals('bottom', 'vertical_align', $test_style); + $test_style->set_valign('top'); + + $this->assertAttributeEquals(array('vertical-align' => 'top'), 'styles', $test_style); } function test_get_valign() { - $test_style = $this->newTextStyle('center'); - $this->assertEquals('center', $test_style->get_valign()); + $test_style = new TextStyle(array('vertical-align' => '')); + + $this->assertEquals('top', $test_style->get_valign()); + + $test_style = new TextStyle(array('vertical-align' => 'bottom')); + + $this->assertEquals('bottom', $test_style->get_valign()); } }