local D=import("\046\046\047\069\110\117\109\047\070\111\110\116")local z=import("\046\046\047\116\121\112\101\115\047\086\101\099\116\111\114\050")local X=import("\046\046\047\102\117\110\099\116\105\111\110\115\047\116\121\112\101\111\102")local C=import("\046\047\084\101\120\116\083\101\114\118\105\099\101")describe("\105\110\115\116\097\110\099\101\115\046\084\101\120\116\083\101\114\118\105\099\101",function()it("\115\104\111\117\108\100 \105\110\115\116\097\110\116\105\097\116\101",function()local D=C:new()assert.not_nil(D)end)describe("\071\101\116\084\101\120\116\083\105\122\101",function()it("\115\104\111\117\108\100 \118\101\114\105\102\121 \112\097\114\097\109\101\116\101\114\115",function()local X=C:new()assert.has.errors(function()X:GetTextSize(100,36,D.Legacy,z.new(1,1))end)assert.has.errors(function()X:GetTextSize("\116\101\120\116","\115\116\114",D.Legacy,z.new(1,1))end)assert.has.errors(function()X:GetTextSize("\116\101\120\116",36,"\104\101\121",z.new(1,1))end)assert.has.errors(function()X:GetTextSize("\116\101\120\116",36,D.Legacy,100)end)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \086\101\099\116\111\114\050",function()local O=C:new()local h=O:GetTextSize("\116\101\120\116",36,D.Legacy,z.new(1000,1000))assert.equals(X(h),"\086\101\099\116\111\114\050")end)it("\115\104\111\117\108\100 \099\108\105\112 \116\104\101 \114\101\099\116 \100\111\119\110",function()local X=C:new()local O=X:GetTextSize("\086\069\082\089 \076\065\082\071\069 \084\069\088\084",36,D.Legacy,z.new(1,1))assert.same({O.X;O.Y},{1;1})end)end)end)
local Font = import("../Enum/Font")
local Vector2 = import("../types/Vector2")
local typeof = import("../functions/typeof")

local TextService = import("./TextService")

describe("instances.TextService", function()
	it("should instantiate", function()
		local instance = TextService:new()

		assert.not_nil(instance)
	end)

	describe("GetTextSize", function()
		it("should verify parameters", function()
			local instance = TextService:new()

			assert.has.errors(function()
				instance:GetTextSize(100, 36, Font.Legacy, Vector2.new(1, 1))
			end)
			assert.has.errors(function()
				instance:GetTextSize("text", "str", Font.Legacy, Vector2.new(1, 1))
			end)
			assert.has.errors(function()
				instance:GetTextSize("text", 36, "hey", Vector2.new(1, 1))
			end)
			assert.has.errors(function()
				instance:GetTextSize("text", 36, Font.Legacy, 100)
			end)
		end)

		it("should return a Vector2", function()
			local instance = TextService:new()
			local result = instance:GetTextSize("text", 36, Font.Legacy, Vector2.new(1000, 1000))

			assert.equals(typeof(result), "Vector2")
		end)

		it("should clip the rect down", function()
			local instance = TextService:new()
			local result = instance:GetTextSize("VERY LARGE TEXT", 36, Font.Legacy, Vector2.new(1, 1))

			assert.same({result.X, result.Y}, {1, 1})
		end)
	end)
end)