summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-05-27 03:53:20 +0000
committerwei <>2006-05-27 03:53:20 +0000
commitf21a3840e2486a298ec6976771888f02e3748ebb (patch)
tree7b5ee50c43a3289762dd7b505e10916c74e979da
parentd333551610131ab486ef566f20b9762645ef5ebb (diff)
Fixed #162 and #163.
-rw-r--r--.gitattributes2
-rw-r--r--framework/I18N/core/NumberFormat.php5
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket163.page9
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/config.xml3
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket163TestCase.php14
5 files changed, 30 insertions, 3 deletions
diff --git a/.gitattributes b/.gitattributes
index 2db5261b..07dc529a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1048,6 +1048,7 @@ tests/FunctionalTests/tickets/protected/pages/Layout.php -text
tests/FunctionalTests/tickets/protected/pages/Layout.tpl -text
tests/FunctionalTests/tickets/protected/pages/Ticket121.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket121.php -text
+tests/FunctionalTests/tickets/protected/pages/Ticket163.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket191.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket191.php -text
tests/FunctionalTests/tickets/protected/pages/Ticket21.page -text
@@ -1066,6 +1067,7 @@ tests/FunctionalTests/tickets/protected/pages/Ticket93.php -text
tests/FunctionalTests/tickets/protected/pages/config.xml -text
tests/FunctionalTests/tickets/protected/pages/hotspot.jpg -text
tests/FunctionalTests/tickets/tests/Ticket121TestCase.php -text
+tests/FunctionalTests/tickets/tests/Ticket163TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket191TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket21TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket27TestCase.php -text
diff --git a/framework/I18N/core/NumberFormat.php b/framework/I18N/core/NumberFormat.php
index d1184f86..8e715f15 100644
--- a/framework/I18N/core/NumberFormat.php
+++ b/framework/I18N/core/NumberFormat.php
@@ -122,7 +122,6 @@ class NumberFormat
$string = (string)$number;
-
$decimal = $this->formatDecimal($string);
$integer = $this->formatInteger(abs($number));
@@ -130,9 +129,9 @@ class NumberFormat
$result = $integer.$decimal;
else
$result = $integer;
-
+
//get the suffix
- if($number > 0)
+ if($number >= 0)
$suffix = $this->formatInfo->PositivePattern;
else if($number < 0)
$suffix = $this->formatInfo->NegativePattern;
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket163.page b/tests/FunctionalTests/tickets/protected/pages/Ticket163.page
new file mode 100644
index 00000000..aa05e601
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket163.page
@@ -0,0 +1,9 @@
+<com:TContent ID="Content">
+ <h1>Test Ticket #163</h1>
+ <h2>Missing currency sign in TNumberFormat if Value is 0</h2>
+ <com:TNumberFormat Type="currency" Culture="no" Currency="NOK" Value="100"/>
+ <hr />
+ <com:TNumberFormat Type="currency" Culture="no" Currency="NOK" Value="0"/>
+ <hr />
+ <com:TNumberFormat Type="currency" Culture="no" Currency="NOK" Value="-100"/>
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/config.xml b/tests/FunctionalTests/tickets/protected/pages/config.xml
index 83bb5791..48a0114c 100644
--- a/tests/FunctionalTests/tickets/protected/pages/config.xml
+++ b/tests/FunctionalTests/tickets/protected/pages/config.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
+ <paths>
+ <using namespace="System.I18N.*" />
+ </paths>
<pages MasterClass="Application.pages.Layout" />
</configuration> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket163TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket163TestCase.php
new file mode 100644
index 00000000..cc78c466
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket163TestCase.php
@@ -0,0 +1,14 @@
+<?php
+
+class Ticket163TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('tickets/index.php?page=Ticket163');
+ $this->assertTextPresent('kr 100,00');
+ $this->assertTextPresent('kr 0,00');
+ $this->assertTextPresent('-kr 100,00');
+ }
+}
+
+?> \ No newline at end of file