--[[----------------------------------------------------------------------------

WFLocalizationUtilsTest.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2012 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

local WFLocalizationUtilsTest = {}

--------------------------------------------------------------------------------

local WFLocalizationUtils = require 'WFLocalizationUtils'
local WFPlatformInfo = require 'WFPlatformInfo'

--------------------------------------------------------------------------------


function WFLocalizationUtilsTest.testGetLanguageCode()
	
	-- FIXME_WIN32:  iOS, Mac, and Android return "English" instead of "en" for lang.
	if not WFPlatformInfo.isWindows then
		local langCode = WFLocalizationUtils.getLanguageCode()
		assert( langCode == "en", "getLanguageCode failed" )
	end
end

--------------------------------------------------------------------------------

function WFLocalizationUtilsTest.testGetRegionCode()
	
	-- add regions as needed
	local testRegions = { 
		US = true, 
		DE = true
	}
	
	-- FIXME_WIN32:  "en-US" is not a region code, it should be just "US".
	if not WFPlatformInfo.isWindows then
		local regionCode = WFLocalizationUtils.getRegionCode()
		assert( testRegions[ regionCode ] , "getRegionCode failed" )
	end
end

--------------------------------------------------------------------------------

function WFLocalizationUtilsTest.testGetLocaleId()

	-- add locales as needed
	local testLocales = {
		[ 'en-US' ] = true,
		[ 'en-DE' ] = true
	}

	-- FIXME_WIN32:  iOS, Mac, and Android return "English" instead of "en" for lang.
	if not WFPlatformInfo.isWindows then
		local locale = WFLocalizationUtils.getLocaleId()
		assert( testLocales[ locale ], "getLocaleId failed" )
	end
end

--------------------------------------------------------------------------------

function WFLocalizationUtilsTest.testUseMetric()
	
	assert( type( WFLocalizationUtils.useMetric ) == 'function', 'fn exists' )
	assert( type( WFLocalizationUtils.useMetric() ) == 'boolean', 'useMetric is a boolean' )

end

return WFLocalizationUtilsTest
