? ? Pending

User tests: Successful: Unsuccessful:

avatar izharaazmi
izharaazmi
26 Aug 2016

Summary of Changes

This PR is in succession with #11026.
With this patch the developers will be able to make use of IEC Binary prefixes for bytes calculation.

To be able to read 1 KB as 1000 bytes, you'd need to pass true as the last/4th argument to JHtmlNumber::bytes which will make the call IEC aware. Otherwise the function should behave same as previously without any B/C break, and stick to real world standard only.

This patch also makes you able to parse values which are already in IEC format like 1.5 GiB, earlier this would return 0 as IEC prefixes were not supported.

To allow return value with automatic unit selection auto unit was already being used, and its still the same. To use automatic unit selection with IEC binary prefixed units the value binary should be used.

Newly supported units are: KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB

Testing Instructions

  1. Test all the values mentioned in #11026 (comment)
  2. Additionally test the newly supported values as below:
echo JHtml::_('number.bytes', '1024 KB', '', 2, true). "\n";
echo JHtml::_('number.bytes', '1024 KiB', '', 2, true). "\n";
echo JHtml::_('number.bytes', 1000 * 1000, 'auto', 2, true). "\n";
echo JHtml::_('number.bytes', 1024 * 1024, 'binary', 2, true). "\n";
echo JHtml::_('number.bytes', 1024 * 1024, 'binary', 2, false). "\n";
echo JHtml::_('number.bytes', '1024 KB', 'KiB', 2, true). "\n";
echo JHtml::_('number.bytes', '1024 KiB', 'kB', 2, true). "\n";

This should return

1024000
1048576
1 MB
1 MiB
1 MiB
1000 KiB
1048.58 kB

When testing keep in mind the following:

  • When IEC awareness is ON: 1 KiB = 1024 B, 1 KB = 1000 B
  • When IEC awareness is OFF: 1 KiB = 1024 B, 1 KB = 1024 B

Documentation Changes Required

The above note should be added to the documentation. I too can do that myself with appropriate guidance.

Votes

# of Users Experiencing Issue
0/1
Average Importance Score
4.00

avatar izharaazmi izharaazmi - open - 26 Aug 2016
avatar izharaazmi izharaazmi - change - 26 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2016
Category Libraries Unit Tests
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2016
Labels Added: ? ?
avatar bhavikTailored
bhavikTailored - comment - 26 Aug 2016
avatar bhavikTailored bhavikTailored - test_item - 26 Aug 2016 - Tested successfully
avatar bhavikTailored
bhavikTailored - comment - 26 Aug 2016

I have tested this item successfully on 11d7794


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11803.

avatar HLeithner
HLeithner - comment - 26 Aug 2016

I would give a successfull test but I'm unable to open this ticket on https://issues.joomla.org/tracker/joomla-cms/11803 ...

avatar HLeithner HLeithner - test_item - 26 Aug 2016 - Tested successfully
avatar HLeithner
HLeithner - comment - 26 Aug 2016

I have tested this item successfully on 11d7794


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11803.

avatar brianteeman brianteeman - change - 26 Aug 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 26 Aug 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11803.

avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2016
Labels Added: ?
avatar rdeutz rdeutz - change - 27 Aug 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-08-27 18:35:09
Closed_By rdeutz
avatar brianteeman
brianteeman - comment - 27 Aug 2016

Thanks

avatar joomla-cms-bot joomla-cms-bot - change - 27 Aug 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment