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

WFOzContentTypesTest.lua

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

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

NOTICE: All information contained herein is, and remains 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 are protected by all applicable
intellectual property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

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

local WFOzContentTypes = require 'WFOzContentTypes'

--==============================================================================

local WFOzContentTypesTest = {}

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

function WFOzContentTypesTest.test_basicTests( test )
	
	assert( WFOzContentTypes, "namespace" )
	
	local imageTypeNumLo, imageTypeNumHi = WFOzContentTypes.getContentTypeNumberRangeForSubType "jpeg"
	local videoTypeNumLo, videoTypeNumHi = WFOzContentTypes.getContentTypeNumberRangeForSubType "video"
	
	local imageTypeNumJpeg = WFOzContentTypes.getContentTypeNumberForContentType "image/jpeg"
	local imageTypeNumPng = WFOzContentTypes.getContentTypeNumberForContentType "image/png"
	local imageTypeNumHeic = WFOzContentTypes.getContentTypeNumberForContentType "image/heic"
	local imageTypeNumOther = WFOzContentTypes.getContentTypeNumberForContentType "image/foobar"
	local videoTypeNumMp4 = WFOzContentTypes.getContentTypeNumberForContentType "video/mp4"
	local videoTypeNumMpeg = WFOzContentTypes.getContentTypeNumberForContentType "video/mpeg"
	local videoTypeNumQuicktime = WFOzContentTypes.getContentTypeNumberForContentType "video/quicktime"
	local videoTypeNumAVCHD = WFOzContentTypes.getContentTypeNumberForContentType "video/MP2T"
	local videoTypeNumOther = WFOzContentTypes.getContentTypeNumberForContentType "video/foobar"
	
	assert( imageTypeNumLo == imageTypeNumOther, "image type numbers" )
	assert( videoTypeNumLo == videoTypeNumOther, "video type numbers" )
	assert( imageTypeNumJpeg < imageTypeNumHi and imageTypeNumJpeg > imageTypeNumLo, "jpeg image num in range" )
	assert( imageTypeNumPng < imageTypeNumHi and imageTypeNumPng > imageTypeNumLo, "png image num in range" )
	assert( imageTypeNumHeic < imageTypeNumHi and imageTypeNumHeic > imageTypeNumLo, "heic image num in range" )

	assert( videoTypeNumMp4 < videoTypeNumHi and videoTypeNumMp4 > videoTypeNumLo, "Mp4 video num in range" )
	assert( videoTypeNumMpeg < videoTypeNumHi and videoTypeNumMpeg > videoTypeNumLo, "Mpeg video num in range" )
	assert( videoTypeNumQuicktime < videoTypeNumHi and videoTypeNumQuicktime > videoTypeNumLo, "Quicktime video num in range" )
	assert( videoTypeNumAVCHD < videoTypeNumHi and videoTypeNumAVCHD > videoTypeNumLo, "AVCHD video num in range" )
	
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( imageTypeNumJpeg, true ) == nil, "omit image/jpeg" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( imageTypeNumJpeg ) == "image/jpeg", "check jpeg content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( imageTypeNumPng ) == "image/png", "check png content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( imageTypeNumHeic ) == "image/heic", "check heic content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( imageTypeNumOther ) == "image/*", "check other video content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( videoTypeNumMp4 ) == "video/mp4", "check mp4 content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( videoTypeNumMpeg ) == "video/mpeg", "check mpeg content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( videoTypeNumQuicktime ) == "video/quicktime", "check quicktime content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( videoTypeNumAVCHD ) == "video/MP2T", "check quicktime content type" )
	assert( WFOzContentTypes.contentTypeForContentTypeNumber( videoTypeNumOther ) == "video/*", "check other video content type" )

	assert( WFOzContentTypes.isVideo( "video/mp4" ) == true, 'check isVideo( "video/mp4" )' )
	assert( WFOzContentTypes.isVideo( "application/octet-stream; video/*" ) == true, 'check isVideo( "application/octet-stream; video/*" )' )
	assert( WFOzContentTypes.isVideo( "image/jpeg" ) == false, 'check isVideo( "image/jpeg" )' )
	assert( WFOzContentTypes.isVideo( {} ) == false, 'check isVideo( {} )' )

	assert( WFOzContentTypes.contentTypeForSubtype( nil ) == 'application/octet-stream' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'unknown' ) == 'application/octet-stream' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'image' ) == 'application/octet-stream' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'deleted_image' ) == 'application/octet-stream' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'video' ) == 'application/octet-stream; video/*' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'deleted_video' ) == 'application/octet-stream; video/*' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'preset' ) == 'application/rdf+xml' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'profile' ) == 'application/rdf+xml' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'lens_profile' ) == 'application/rdf+xml' )
	assert( WFOzContentTypes.contentTypeForSubtype( 'camera_profile' ) == 'application/octet-stream' )

end

--==============================================================================

return WFOzContentTypesTest
