This is an automated email from the ASF dual-hosted git repository.
junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new c00efa0 [NETBEANS-4483] Fixed unit tests for Latte Templates
new 174d84c Merge pull request #2208 from
KacerCZ/netbeans-4486-fix-latte-tests
c00efa0 is described below
commit c00efa0f0140b7315bce33da3a5aaeb168338453
Author: Tomas Prochazka <[email protected]>
AuthorDate: Sun Jun 21 08:59:50 2020 +0200
[NETBEANS-4483] Fixed unit tests for Latte Templates
https://issues.apache.org/jira/browse/NETBEANS-4486
- Deleted tests related to files removed during donation from Oracle.
- Deleted unused files.
- Fixed loading of files containig UTF-8 characters (test
LatteCompletionTest::testCompletion_03() was failing because of this).
- Enabled tests in Travis and Github Actions.
---
.github/workflows/main.yml | 2 +-
.travis.yml | 2 +-
.../netbeans/modules/csl/api/test/CslTestBase.java | 13 +-
.../data/testfiles/indent/testRealFile_01.latte | 237 +++++++++++++++++++++
.../indent/testRealFile_01.latte.formatted | 237 +++++++++++++++++++++
.../data/testfiles/indent/testRealFile_02.latte | 6 +
.../indent/testRealFile_02.latte.formatted | 6 +
.../data/testfiles/indent/testRealFile_03.latte | 78 +++++++
.../indent/testRealFile_03.latte.formatted | 78 +++++++
.../data/testfiles/indent/testRealFile_04.latte | 79 +++++++
.../indent/testRealFile_04.latte.formatted | 79 +++++++
.../testfiles/parser/issue245728_04.latte.errors | 0
.../testfiles/parser/issue245728_05.latte.errors | 0
.../testfiles/parser/issue245728_06.latte.errors | 0
.../php/latte/indent/LatteIndenterTestBase.java | 10 +
.../php/latte/parser/LatteParserErrorTest.java | 3 +
16 files changed, 821 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ffd3480..310a5a5 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -63,7 +63,7 @@ jobs:
ant -f php/php.dbgp test
ant -f php/php.doctrine2 test
# ant -f php/php.editor test
- # ant -f php/php.latte test
+ ant -f php/php.latte test
ant -f php/php.nette.tester test
ant -f php/php.phpunit test
ant -f php/php.project test
diff --git a/.travis.yml b/.travis.yml
index 6637666..e18ce22 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -680,7 +680,7 @@ matrix:
#- ant $OPTS -f php/php.dbgp test
- ant $OPTS -f php/php.doctrine2 test
#- ant $OPTS -f php/php.editor test
- #- ant $OPTS -f php/php.latte test
+ - ant $OPTS -f php/php.latte test
- ant $OPTS -f php/php.nette.tester test
- ant $OPTS -f php/php.phpunit test
- ant $OPTS -f php/php.project test
diff --git
a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
index e37b66a..bb1448f 100644
---
a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
+++
b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
@@ -38,7 +38,9 @@ import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Method;
import java.net.URL;
-import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -541,12 +543,9 @@ public abstract class CslTestBase extends NbTestCase {
}
public static String readFile(File f) throws IOException {
- FileReader r = new FileReader(f);
- int fileLen = (int)f.length();
- CharBuffer cb = CharBuffer.allocate(fileLen);
- r.read(cb);
- cb.rewind();
- return cb.toString();
+ Charset charset = StandardCharsets.UTF_8;
+ String content = new String(Files.readAllBytes(f.toPath()), charset);
+ return content;
}
protected File getDataSourceDir() {
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_01.latte
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_01.latte
new file mode 100644
index 0000000..e9d50b8
--- /dev/null
+++ b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_01.latte
@@ -0,0 +1,237 @@
+{*
+ * New BSD License
+ * ---------------
+ *
+ * Copyright (c) 2009, Ondřej Brejla <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the "Eciovni" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *}
+{*
+ * @param string $title
+ * @param string $id
+ *
+ * @param string $supplierName
+ * @param string $supplierStreet
+ * @param string $supplierHouseNumber
+ * @param string $supplierCity
+ * @param string $supplierZip
+ * @param string $supplierIn
+ * @param string $supplierTin
+ * @param string $supplierAccountNumber
+ *
+ * @param string $dateOfIssuance
+ * @param string $expirationDate
+ * @param string $dateOfVatRevenueRecognition
+ *
+ * @param string $variableSymbol
+ * @param string $specificSymbol
+ * @param string $constantSymbol
+ *
+ * @param string $customerName
+ * @param string $customerStreet
+ * @param string $customerHouseNumber
+ * @param string $customerCity
+ * @param string $customerZip
+ * @param string $customerIn
+ * @param string $customerTin
+ * @param string $customerAccountNumber
+ *
+ * @param Item[] $items
+ *
+ * @param float $finalUntaxedValue
+ * @param float $finalTaxValue
+ * @param float $finalValue
+ *}
+<html lang="cs">
+<head>
+ <meta http-equiv="Content-Language" content="cs">
+</head>
+<body>
+<style type="text/css">
+ body {
+ font-family: Arial;
+ }
+
+ table {
+ font-size: 12px;
+ }
+</style>
+<div>
+ <div style="text-align:right;border-bottom:2px solid
#000000;color:#1A5DAC;font-weight:bold;font-size:20px">
+ {$title} - {$id}
+ </div>
+ <table>
+ <tr>
+ <td width="{$contactSizeRatio}%">
+ <span
style="color:#1A5DAC;font-weight:bold;font-size:12px">Dodavatel:</span>
+ <table
style="font-weight:bold;margin-bottom:15px">
+ <tr>
+ <td>{$supplierName}</td>
+ </tr>
+ <tr>
+ <td>{$supplierStreet}
{$supplierHouseNumber}</td>
+ </tr>
+ <tr>
+ <td>{$supplierCity},
{$supplierZip}</td>
+ </tr>
+ </table>
+
+ <table style="color:#1A5DAC;margin-bottom:15px">
+ <tr n:if="$supplierIn">
+ <td>IČ:</td>
+ <td>{$supplierIn}</td>
+ </tr>
+ <tr n:if="$supplierTin">
+ <td>DIČ:</td>
+ <td>{$supplierTin}</td>
+ </tr>
+ </table>
+
+ <table style="width:100%;margin-bottom:15px"
n:if="$supplierAccountNumber">
+ <tr>
+ <td>Číslo účtu:</td>
+ <td
style="text-align:center;border:3px solid #000000;font-weight:bold" width="220">
+ {$supplierAccountNumber}
+ </td>
+ </tr>
+ </table>
+
+ <table style="width:100%">
+ <tr>
+ <td>Forma úhrady:</td>
+ <td
style="text-align:right">{$paymentMethod}</td>
+ </tr>
+ <tr n:if="$dateOfIssuance">
+ <td>Datum vystavení:</td>
+ <td
style="text-align:right">{$dateOfIssuance|replace:' ':' '|noescape}</td>
+ </tr>
+ <tr n:if="$expirationDate">
+ <td>Datum splatnosti:</td>
+ <td
style="text-align:right">{$expirationDate|replace:' ':' '|noescape}</td>
+ </tr>
+ <tr n:if="$dateOfVatRevenueRecognition">
+ <td>Datum uskutečnění
zdanitelného plnění:</td>
+ <td
style="text-align:right">{$dateOfVatRevenueRecognition|replace:'
':' '|noescape}</td>
+ </tr>
+ </table>
+ </td>
+ <td width="{100 - $contactSizeRatio}%" align="right">
+ <table style="margin-bottom:15px"
n:if="$constantSymbol || $specificSymbol || $variableSymbol">
+ <tr n:if="$variableSymbol">
+ <td
style="text-align:right">Variabilní symbol:</td>
+ <td
style="text-align:left">{$variableSymbol}</td>
+ </tr>
+ <tr n:if="$specificSymbol">
+ <td
style="text-align:right">Specifický symbol:</td>
+ <td
style="text-align:left">{$specificSymbol}</td>
+ </tr>
+ <tr n:if="$constantSymbol">
+ <td
style="text-align:right">Konstantní symbol:</td>
+ <td
style="text-align:left">{$constantSymbol}</td>
+ </tr>
+ </table>
+
+ <table style="border: 3px solid #000000">
+ <tr>
+ <td width="350">
+ <span
style="color:#1A5DAC;font-weight:bold;font-size:12px">Odběratel:</span>
+ <table
style="margin-bottom:15px">
+ <tr
n:if="$customerIn">
+
<td>IČ:</td>
+
<td>{$customerIn == 0 ? '' : $customerIn}</td>
+ </tr>
+ <tr
n:if="$customerTin">
+
<td>DIČ:</td>
+
<td>{$customerTin}</td>
+ </tr>
+ <tr
n:if="$customerAccountNumber">
+
<td>Číslo účtu:</td>
+
<td>{$customerAccountNumber}</td>
+ </tr>
+ </table>
+
+ <table
style="font-weight:bold;margin-bottom:15px">
+ <tr
n:if="$customerName">
+
<td>{$customerName}</td>
+ </tr>
+ <tr
n:if="$customerStreet || $customerHouseNumber">
+
<td>{$customerStreet} {$customerHouseNumber}</td>
+ </tr>
+ <tr
n:if="$customerCity || $customerZip">
+
<td>{$customerCity}, {$customerZip}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <div style="border:1px solid #BEC8CE;clear:both;margin-bottom:15px">
+ <table style="width:100%">
+ <tr>
+ <td><strong>Položka</strong></td>
+ <td
style="text-align:right"><strong>Cena/jedn.</strong></td>
+ <td
style="text-align:right"><strong>Počet</strong></td>
+ <td
style="text-align:right"><strong>%DPH</strong></td>
+ <td
style="text-align:right"><strong>DPH</strong></td>
+ <td style="text-align:right"><strong>Cena
(Kč)</strong></td>
+ </tr>
+ {foreach $items as $item}
+ <tr>
+ <td>{$item->getDescription()}</td>
+ <td
style="text-align:right">{$item->countUntaxedUnitValue()|round|replace:'
':' '|noescape}</td>
+ <td
style="text-align:right">{$item->getUnits()|round|replace:'
':' '|noescape}</td>
+ <td
style="text-align:right">{$item->getTax()->inUpperDecimal() * 100 -
100|round|replace:' ':' '|noescape}</td>
+ <td
style="text-align:right">{$item->countTaxValue()|round|replace:'
':' '|noescape}</td>
+ <td
style="text-align:right">{$item->countFinalValue()|round|replace:'
':' '|noescape}</td>
+ </tr>
+ {/foreach}
+ </table>
+ </div>
+
+ <div style="border:2px solid #000000;margin-bottom:15px">
+ <table style="width:100%">
+ <tr>
+ <td>Celkem bez DPH (Kč):</td>
+ <td
style="text-align:right">{$finalUntaxedValue|round|replace:'
':' '|noescape}</td>
+ </tr>
+ <tr>
+ <td>DPH (Kč):</td>
+ <td
style="text-align:right">{$finalTaxValue|round|replace:'
':' '|noescape}</td>
+ </tr>
+ <tr style="font-size:20px">
+ <td><strong>Cena celkem s DPH
(Kč):</strong></td>
+ <td
style="text-align:right"><strong>{$finalValue|round|replace:'
':' '|noescape}</strong></td>
+ </tr>
+ </table>
+ </div>
+
+ <div n:if="$stampPath" style="text-align:right;padding-right:100px">
+ <div style="font-weight:bold">Vystavil, razítko, podpis:</div>
+ <img
src="data:image/png;base64,{base64_encode(file_get_contents($stampPath))|noescape}"
alt="Razitko s podpisem"/>
+ </div>
+</div>
+</body>
+</html>
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_01.latte.formatted
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_01.latte.formatted
new file mode 100644
index 0000000..5252feb
--- /dev/null
+++
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_01.latte.formatted
@@ -0,0 +1,237 @@
+{*
+ * New BSD License
+ * ---------------
+ *
+ * Copyright (c) 2009, Ondřej Brejla <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the "Eciovni" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*}
+{*
+ * @param string $title
+ * @param string $id
+ *
+ * @param string $supplierName
+ * @param string $supplierStreet
+ * @param string $supplierHouseNumber
+ * @param string $supplierCity
+ * @param string $supplierZip
+ * @param string $supplierIn
+ * @param string $supplierTin
+ * @param string $supplierAccountNumber
+ *
+ * @param string $dateOfIssuance
+ * @param string $expirationDate
+ * @param string $dateOfVatRevenueRecognition
+ *
+ * @param string $variableSymbol
+ * @param string $specificSymbol
+ * @param string $constantSymbol
+ *
+ * @param string $customerName
+ * @param string $customerStreet
+ * @param string $customerHouseNumber
+ * @param string $customerCity
+ * @param string $customerZip
+ * @param string $customerIn
+ * @param string $customerTin
+ * @param string $customerAccountNumber
+ *
+ * @param Item[] $items
+ *
+ * @param float $finalUntaxedValue
+ * @param float $finalTaxValue
+ * @param float $finalValue
+*}
+<html lang="cs">
+ <head>
+ <meta http-equiv="Content-Language" content="cs">
+ </head>
+ <body>
+ <style type="text/css">
+ body {
+ font-family: Arial;
+ }
+
+ table {
+ font-size: 12px;
+ }
+ </style>
+ <div>
+ <div style="text-align:right;border-bottom:2px solid
#000000;color:#1A5DAC;font-weight:bold;font-size:20px">
+ {$title} - {$id}
+ </div>
+ <table>
+ <tr>
+ <td width="{$contactSizeRatio}%">
+ <span
style="color:#1A5DAC;font-weight:bold;font-size:12px">Dodavatel:</span>
+ <table style="font-weight:bold;margin-bottom:15px">
+ <tr>
+ <td>{$supplierName}</td>
+ </tr>
+ <tr>
+ <td>{$supplierStreet}
{$supplierHouseNumber}</td>
+ </tr>
+ <tr>
+ <td>{$supplierCity}, {$supplierZip}</td>
+ </tr>
+ </table>
+
+ <table style="color:#1A5DAC;margin-bottom:15px">
+ <tr n:if="$supplierIn">
+ <td>IČ:</td>
+ <td>{$supplierIn}</td>
+ </tr>
+ <tr n:if="$supplierTin">
+ <td>DIČ:</td>
+ <td>{$supplierTin}</td>
+ </tr>
+ </table>
+
+ <table style="width:100%;margin-bottom:15px"
n:if="$supplierAccountNumber">
+ <tr>
+ <td>Číslo účtu:</td>
+ <td style="text-align:center;border:3px solid
#000000;font-weight:bold" width="220">
+ {$supplierAccountNumber}
+ </td>
+ </tr>
+ </table>
+
+ <table style="width:100%">
+ <tr>
+ <td>Forma úhrady:</td>
+ <td
style="text-align:right">{$paymentMethod}</td>
+ </tr>
+ <tr n:if="$dateOfIssuance">
+ <td>Datum vystavení:</td>
+ <td
style="text-align:right">{$dateOfIssuance|replace:' ':' '|noescape}</td>
+ </tr>
+ <tr n:if="$expirationDate">
+ <td>Datum splatnosti:</td>
+ <td
style="text-align:right">{$expirationDate|replace:' ':' '|noescape}</td>
+ </tr>
+ <tr n:if="$dateOfVatRevenueRecognition">
+ <td>Datum uskutečnění zdanitelného plnění:</td>
+ <td
style="text-align:right">{$dateOfVatRevenueRecognition|replace:'
':' '|noescape}</td>
+ </tr>
+ </table>
+ </td>
+ <td width="{100 - $contactSizeRatio}%" align="right">
+ <table style="margin-bottom:15px"
n:if="$constantSymbol || $specificSymbol || $variableSymbol">
+ <tr n:if="$variableSymbol">
+ <td style="text-align:right">Variabilní
symbol:</td>
+ <td
style="text-align:left">{$variableSymbol}</td>
+ </tr>
+ <tr n:if="$specificSymbol">
+ <td style="text-align:right">Specifický
symbol:</td>
+ <td
style="text-align:left">{$specificSymbol}</td>
+ </tr>
+ <tr n:if="$constantSymbol">
+ <td style="text-align:right">Konstantní
symbol:</td>
+ <td
style="text-align:left">{$constantSymbol}</td>
+ </tr>
+ </table>
+
+ <table style="border: 3px solid #000000">
+ <tr>
+ <td width="350">
+ <span
style="color:#1A5DAC;font-weight:bold;font-size:12px">Odběratel:</span>
+ <table style="margin-bottom:15px">
+ <tr n:if="$customerIn">
+ <td>IČ:</td>
+ <td>{$customerIn == 0 ? '' :
$customerIn}</td>
+ </tr>
+ <tr n:if="$customerTin">
+ <td>DIČ:</td>
+ <td>{$customerTin}</td>
+ </tr>
+ <tr n:if="$customerAccountNumber">
+ <td>Číslo účtu:</td>
+ <td>{$customerAccountNumber}</td>
+ </tr>
+ </table>
+
+ <table
style="font-weight:bold;margin-bottom:15px">
+ <tr n:if="$customerName">
+ <td>{$customerName}</td>
+ </tr>
+ <tr n:if="$customerStreet ||
$customerHouseNumber">
+ <td>{$customerStreet}
{$customerHouseNumber}</td>
+ </tr>
+ <tr n:if="$customerCity ||
$customerZip">
+ <td>{$customerCity},
{$customerZip}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <div style="border:1px solid
#BEC8CE;clear:both;margin-bottom:15px">
+ <table style="width:100%">
+ <tr>
+ <td><strong>Položka</strong></td>
+ <td
style="text-align:right"><strong>Cena/jedn.</strong></td>
+ <td
style="text-align:right"><strong>Počet</strong></td>
+ <td style="text-align:right"><strong>%DPH</strong></td>
+ <td style="text-align:right"><strong>DPH</strong></td>
+ <td style="text-align:right"><strong>Cena
(Kč)</strong></td>
+ </tr>
+ {foreach $items as $item}
+ <tr>
+ <td>{$item->getDescription()}</td>
+ <td
style="text-align:right">{$item->countUntaxedUnitValue()|round|replace:'
':' '|noescape}</td>
+ <td
style="text-align:right">{$item->getUnits()|round|replace:'
':' '|noescape}</td>
+ <td
style="text-align:right">{$item->getTax()->inUpperDecimal() * 100 -
100|round|replace:' ':' '|noescape}</td>
+ <td
style="text-align:right">{$item->countTaxValue()|round|replace:'
':' '|noescape}</td>
+ <td
style="text-align:right">{$item->countFinalValue()|round|replace:'
':' '|noescape}</td>
+ </tr>
+ {/foreach}
+ </table>
+ </div>
+
+ <div style="border:2px solid #000000;margin-bottom:15px">
+ <table style="width:100%">
+ <tr>
+ <td>Celkem bez DPH (Kč):</td>
+ <td
style="text-align:right">{$finalUntaxedValue|round|replace:'
':' '|noescape}</td>
+ </tr>
+ <tr>
+ <td>DPH (Kč):</td>
+ <td
style="text-align:right">{$finalTaxValue|round|replace:'
':' '|noescape}</td>
+ </tr>
+ <tr style="font-size:20px">
+ <td><strong>Cena celkem s DPH (Kč):</strong></td>
+ <td
style="text-align:right"><strong>{$finalValue|round|replace:'
':' '|noescape}</strong></td>
+ </tr>
+ </table>
+ </div>
+
+ <div n:if="$stampPath"
style="text-align:right;padding-right:100px">
+ <div style="font-weight:bold">Vystavil, razítko, podpis:</div>
+ <img
src="data:image/png;base64,{base64_encode(file_get_contents($stampPath))|noescape}"
alt="Razitko s podpisem"/>
+ </div>
+ </div>
+ </body>
+</html>
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_02.latte
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_02.latte
new file mode 100644
index 0000000..06e57b8
--- /dev/null
+++ b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_02.latte
@@ -0,0 +1,6 @@
+{foreach $cart->items as $item}
+<div class="cart-item">
+ <span class="product">{$item->name}</span><br>
+ {$item->price}
+</div>
+{/foreach}
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_02.latte.formatted
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_02.latte.formatted
new file mode 100644
index 0000000..d6f4426
--- /dev/null
+++
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_02.latte.formatted
@@ -0,0 +1,6 @@
+{foreach $cart->items as $item}
+ <div class="cart-item">
+ <span class="product">{$item->name}</span><br>
+ {$item->price}
+ </div>
+{/foreach}
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_03.latte
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_03.latte
new file mode 100644
index 0000000..c939af9
--- /dev/null
+++ b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_03.latte
@@ -0,0 +1,78 @@
+{*
+ * New BSD License
+ * ---------------
+ *
+ * Copyright (c) 2009, Ondřej Brejla <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the "Pollie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *}
+{**
+ * Template for PollieForm - part of Pollie component for Nette Framework.
+ *
+ * @copyright Copyright (c) 2009 Ondřej Brejla
+ * @license New BSD License
+ * @link http://github.com/OndrejBrejla/Pollie
+ *
+ * @param string $question
+ * @param Answer[] $answers
+ * @param int $allVotesCount
+ * @param boolean $isVotable
+ *}
+<div style="border: 3px solid #1E5EB6; width: 200px;">
+{snippet}
+ <table style="width: 100%;">
+ <tr>
+ <td style="background-color: #DEE7EC;"><h4>{$question}</h4></td>
+ </tr>
+ {foreach $answers as $answer}
+ <tr>
+ <td style="border-top: 1px solid black; color:
#C00000;">{$answer->text}</td>
+ </tr>
+ <tr>
+ <td style="font-size: 10px;">
+ ({$answer->votesCount}x - {$ratio = $allVotesCount ?
round($answer->votesCount/($allVotesCount/100), 2) : 0}%) <br />
+ <img src="/images/pixel-darkblue.png" width="{$ratio * 200/100}"
height="10" border="0" />
+ </td>
+ </tr>
+ {/foreach}
+ <tr>
+ <td style="border-top: 1px solid black;">
+ {if $isVotable}
+ {control pollieForm}
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td style="border-top: 1px solid black; font-size: 10px;
background-color: #DEE7EC;">Total votes: <strong>{$allVotesCount}</strong></td>
+ </tr>
+ {if $flashes}
+ {foreach $flashes as $flash}
+ <tr>
+ <td style="border-top: 1px solid black; font-size: 10px;
background-color: #DEE7EC;">{$flash->message}</td>
+ </tr>
+ {/foreach}
+ {/if}
+ </table>
+{/snippet}
+</div>
\ No newline at end of file
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_03.latte.formatted
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_03.latte.formatted
new file mode 100644
index 0000000..0e7b56c
--- /dev/null
+++
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_03.latte.formatted
@@ -0,0 +1,78 @@
+{*
+ * New BSD License
+ * ---------------
+ *
+ * Copyright (c) 2009, Ondřej Brejla <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the "Pollie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*}
+{**
+ * Template for PollieForm - part of Pollie component for Nette Framework.
+ *
+ * @copyright Copyright (c) 2009 Ondřej Brejla
+ * @license New BSD License
+ * @link http://github.com/OndrejBrejla/Pollie
+ *
+ * @param string $question
+ * @param Answer[] $answers
+ * @param int $allVotesCount
+ * @param boolean $isVotable
+*}
+<div style="border: 3px solid #1E5EB6; width: 200px;">
+ {snippet}
+ <table style="width: 100%;">
+ <tr>
+ <td style="background-color:
#DEE7EC;"><h4>{$question}</h4></td>
+ </tr>
+ {foreach $answers as $answer}
+ <tr>
+ <td style="border-top: 1px solid black; color:
#C00000;">{$answer->text}</td>
+ </tr>
+ <tr>
+ <td style="font-size: 10px;">
+ ({$answer->votesCount}x - {$ratio = $allVotesCount ?
round($answer->votesCount/($allVotesCount/100), 2) : 0}%) <br />
+ <img src="/images/pixel-darkblue.png" width="{$ratio *
200/100}" height="10" border="0" />
+ </td>
+ </tr>
+ {/foreach}
+ <tr>
+ <td style="border-top: 1px solid black;">
+ {if $isVotable}
+ {control pollieForm}
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td style="border-top: 1px solid black; font-size: 10px;
background-color: #DEE7EC;">Total votes: <strong>{$allVotesCount}</strong></td>
+ </tr>
+ {if $flashes}
+ {foreach $flashes as $flash}
+ <tr>
+ <td style="border-top: 1px solid black; font-size:
10px; background-color: #DEE7EC;">{$flash->message}</td>
+ </tr>
+ {/foreach}
+ {/if}
+ </table>
+ {/snippet}
+</div>
\ No newline at end of file
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_04.latte
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_04.latte
new file mode 100644
index 0000000..fc4a927
--- /dev/null
+++ b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_04.latte
@@ -0,0 +1,79 @@
+{*
+ * New BSD License
+ * ---------------
+ *
+ * Copyright (c) 2009, Ondřej Brejla <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the "Pollie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *}
+{**
+ * Template for PollieLink - part of Pollie component for Nette Framework.
+ *
+ * @copyright Copyright (c) 2009 Ondřej Brejla
+ * @license New BSD License
+ * @link http://github.com/OndrejBrejla/Pollie
+ *
+ * @param string $question
+ * @param Answer[] $answers
+ * @param int $allVotesCount
+ * @param boolean $isVotable
+ *}
+<div style="border: 3px solid #1E5EB6; width: 200px;">
+{snippet}
+
+ <table style="width: 100%;">
+ <tr>
+ <td style="background-color: #DEE7EC;"><h4>{$question}</h4></td>
+ </tr>
+ {foreach $answers as $answer}
+ <tr>
+ <td style="border-top: 1px solid black;">
+ {if $isVotable}
+ <a href="{link vote! $answer->id}"
class="ajax">{$answer->text}</a>
+ {else}
+ {$answer->text}
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td style="font-size: 10px;">
+ ({$answer->votesCount}x - {$ratio = $allVotesCount ?
round($answer->votesCount/($allVotesCount/100), 2) : 0}%) <br />
+ <img src="/images/pixel-darkblue.png" width="{$ratio * 200/100}"
height="10" border="0" />
+ </td>
+ </tr>
+ {/foreach}
+ <tr>
+ <td style="border-top: 1px solid black; font-size: 10px;
background-color: #DEE7EC;">Total votes: <strong>{$allVotesCount}</strong></td>
+ </tr>
+ {if $flashes}
+ {foreach $flashes as $flash}
+ <tr>
+ <td style="border-top: 1px solid black; font-size: 10px;
background-color: #DEE7EC;">{$flash->message}</td>
+ </tr>
+ {/foreach}
+ {/if}
+ </table>
+
+{/snippet}
+</div>
\ No newline at end of file
diff --git
a/php/php.latte/test/unit/data/testfiles/indent/testRealFile_04.latte.formatted
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_04.latte.formatted
new file mode 100644
index 0000000..1d595a2
--- /dev/null
+++
b/php/php.latte/test/unit/data/testfiles/indent/testRealFile_04.latte.formatted
@@ -0,0 +1,79 @@
+{*
+ * New BSD License
+ * ---------------
+ *
+ * Copyright (c) 2009, Ondřej Brejla <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the "Pollie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*}
+{**
+ * Template for PollieLink - part of Pollie component for Nette Framework.
+ *
+ * @copyright Copyright (c) 2009 Ondřej Brejla
+ * @license New BSD License
+ * @link http://github.com/OndrejBrejla/Pollie
+ *
+ * @param string $question
+ * @param Answer[] $answers
+ * @param int $allVotesCount
+ * @param boolean $isVotable
+*}
+<div style="border: 3px solid #1E5EB6; width: 200px;">
+ {snippet}
+
+ <table style="width: 100%;">
+ <tr>
+ <td style="background-color:
#DEE7EC;"><h4>{$question}</h4></td>
+ </tr>
+ {foreach $answers as $answer}
+ <tr>
+ <td style="border-top: 1px solid black;">
+ {if $isVotable}
+ <a href="{link vote! $answer->id}"
class="ajax">{$answer->text}</a>
+ {else}
+ {$answer->text}
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td style="font-size: 10px;">
+ ({$answer->votesCount}x - {$ratio = $allVotesCount ?
round($answer->votesCount/($allVotesCount/100), 2) : 0}%) <br />
+ <img src="/images/pixel-darkblue.png" width="{$ratio *
200/100}" height="10" border="0" />
+ </td>
+ </tr>
+ {/foreach}
+ <tr>
+ <td style="border-top: 1px solid black; font-size: 10px;
background-color: #DEE7EC;">Total votes: <strong>{$allVotesCount}</strong></td>
+ </tr>
+ {if $flashes}
+ {foreach $flashes as $flash}
+ <tr>
+ <td style="border-top: 1px solid black; font-size:
10px; background-color: #DEE7EC;">{$flash->message}</td>
+ </tr>
+ {/foreach}
+ {/if}
+ </table>
+
+ {/snippet}
+</div>
\ No newline at end of file
diff --git
a/php/php.latte/test/unit/data/testfiles/parser/issue245728_04.latte.errors
b/php/php.latte/test/unit/data/testfiles/parser/issue245728_04.latte.errors
deleted file mode 100644
index e69de29..0000000
diff --git
a/php/php.latte/test/unit/data/testfiles/parser/issue245728_05.latte.errors
b/php/php.latte/test/unit/data/testfiles/parser/issue245728_05.latte.errors
deleted file mode 100644
index e69de29..0000000
diff --git
a/php/php.latte/test/unit/data/testfiles/parser/issue245728_06.latte.errors
b/php/php.latte/test/unit/data/testfiles/parser/issue245728_06.latte.errors
deleted file mode 100644
index e69de29..0000000
diff --git
a/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/indent/LatteIndenterTestBase.java
b/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/indent/LatteIndenterTestBase.java
index 7382e1b..4e4eaba 100644
---
a/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/indent/LatteIndenterTestBase.java
+++
b/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/indent/LatteIndenterTestBase.java
@@ -18,6 +18,8 @@
*/
package org.netbeans.modules.php.latte.indent;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import javax.swing.text.Document;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.fail;
@@ -33,9 +35,11 @@ import
org.netbeans.modules.html.editor.indent.HtmlIndentTaskFactory;
import org.netbeans.modules.php.latte.LatteTestBase;
import org.netbeans.modules.php.latte.lexer.LatteTopTokenId;
import org.netbeans.modules.web.indent.api.support.AbstractIndenter;
+import org.netbeans.spi.queries.FileEncodingQueryImplementation;
import org.openide.cookies.EditorCookie;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObject;
+import org.openide.util.test.MockLookup;
/**
*
@@ -55,6 +59,12 @@ public abstract class LatteIndenterTestBase extends
LatteTestBase {
MockMimeLookup.setInstances(MimePath.parse("text/x-latte"), factory,
LatteTopTokenId.language());
HtmlIndentTaskFactory htmlReformatFactory = new
HtmlIndentTaskFactory();
MockMimeLookup.setInstances(MimePath.parse("text/html"),
htmlReformatFactory, new HtmlKit("text/x-latte"), HTMLTokenId.language());
+ MockLookup.setInstances(new FileEncodingQueryImplementation() {
+ @Override
+ public Charset getEncoding(FileObject file) {
+ return StandardCharsets.UTF_8;
+ }
+ });
}
@Override
diff --git
a/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/parser/LatteParserErrorTest.java
b/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/parser/LatteParserErrorTest.java
index e83effb..624bd18 100644
---
a/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/parser/LatteParserErrorTest.java
+++
b/php/php.latte/test/unit/src/org/netbeans/modules/php/latte/parser/LatteParserErrorTest.java
@@ -43,6 +43,8 @@ public class LatteParserErrorTest extends LatteTestBase {
checkErrors("testfiles/parser/issue245728_03.latte");
}
+ /*
+ Tests are disabled because test files were not donated.
public void testIssue245728_04() throws Exception {
checkErrors("testfiles/parser/issue245728_04.latte");
}
@@ -54,6 +56,7 @@ public class LatteParserErrorTest extends LatteTestBase {
public void testIssue245728_06() throws Exception {
checkErrors("testfiles/parser/issue245728_06.latte");
}
+ */
public void testIssue245728_07() throws Exception {
checkErrors("testfiles/parser/issue245728_07.latte");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists