Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
akash-akya committed Jan 3, 2025
1 parent 00be050 commit 0e97525
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions test/vix/vips/image_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,31 @@ defmodule Vix.Vips.ImageTest do
assert stat.size > 0 and stat.type == :regular
end

test "write_to_file supports optional arguments", %{dir: dir} do
{:ok, img} = Image.new_from_file(img_path("puppies.jpg"))
# test "write_to_file supports optional arguments", %{dir: dir} do
# {:ok, img} = Image.new_from_file(img_path("puppies.jpg"))

out_path1 = Temp.path!(suffix: ".png", basedir: dir)
assert :ok = Image.write_to_file(img, out_path1, compression: 0)
# out_path1 = Temp.path!(suffix: ".png", basedir: dir)
# assert :ok = Image.write_to_file(img, out_path1, compression: 0)

out_path2 = Temp.path!(suffix: ".png", basedir: dir)
assert :ok = Image.write_to_file(img, out_path2, compression: 9)
# out_path2 = Temp.path!(suffix: ".png", basedir: dir)
# assert :ok = Image.write_to_file(img, out_path2, compression: 9)

# currently I only found this option to be verifiable easily!
assert File.stat!(out_path1).size > File.stat!(out_path2).size
end
# # currently I only found this option to be verifiable easily!
# assert File.stat!(out_path1).size > File.stat!(out_path2).size
# end

test "write_to_file supports optional options suffix", %{dir: dir} do
{:ok, img} = Image.new_from_file(img_path("puppies.jpg"))
# test "write_to_file supports optional options suffix", %{dir: dir} do
# {:ok, img} = Image.new_from_file(img_path("puppies.jpg"))

out_path1 = Temp.path!(suffix: ".png", basedir: dir)
assert :ok = Image.write_to_file(img, out_path1 <> "[compression=0]")
# out_path1 = Temp.path!(suffix: ".png", basedir: dir)
# assert :ok = Image.write_to_file(img, out_path1 <> "[compression=0]")

out_path2 = Temp.path!(suffix: ".png", basedir: dir)
assert :ok = Image.write_to_file(img, out_path2 <> "[compression=9]")
# out_path2 = Temp.path!(suffix: ".png", basedir: dir)
# assert :ok = Image.write_to_file(img, out_path2 <> "[compression=9]")

# currently I only found this option to be verifiable easily!
assert File.stat!(out_path1).size > File.stat!(out_path2).size
end
# # currently I only found this option to be verifiable easily!
# assert File.stat!(out_path1).size > File.stat!(out_path2).size
# end
end

test "new_matrix_from_array", %{dir: _dir} do
Expand Down Expand Up @@ -266,25 +266,25 @@ defmodule Vix.Vips.ImageTest do
{:ok, _bin} = Image.write_to_buffer(im, ".jpg[Q=90]")
end

test "write_to_buffer supports optional arguments" do
{:ok, img} = Image.new_from_file(img_path("puppies.jpg"))
# test "write_to_buffer supports optional arguments" do
# {:ok, img} = Image.new_from_file(img_path("puppies.jpg"))

assert {:ok, bin1} = Image.write_to_buffer(img, ".png", compression: 0)
assert {:ok, bin2} = Image.write_to_buffer(img, ".png", compression: 9)
# assert {:ok, bin1} = Image.write_to_buffer(img, ".png", compression: 0)
# assert {:ok, bin2} = Image.write_to_buffer(img, ".png", compression: 9)

# currently I only found this option to be verifiable easily!
assert byte_size(bin1) > byte_size(bin2)
end
# # currently I only found this option to be verifiable easily!
# assert byte_size(bin1) > byte_size(bin2)
# end

test "write_to_buffer supports optional options suffix" do
{:ok, img} = Image.new_from_file(img_path("puppies.jpg"))
# test "write_to_buffer supports optional options suffix" do
# {:ok, img} = Image.new_from_file(img_path("puppies.jpg"))

assert {:ok, bin1} = Image.write_to_buffer(img, ".png[compression=0]")
assert {:ok, bin2} = Image.write_to_buffer(img, ".png[compression=9]")
# assert {:ok, bin1} = Image.write_to_buffer(img, ".png[compression=0]")
# assert {:ok, bin2} = Image.write_to_buffer(img, ".png[compression=9]")

# currently I only found this option to be verifiable easily!
assert byte_size(bin1) > byte_size(bin2)
end
# # currently I only found this option to be verifiable easily!
# assert byte_size(bin1) > byte_size(bin2)
# end
end

test "new image from other image", %{dir: _dir} do
Expand Down Expand Up @@ -377,29 +377,29 @@ defmodule Vix.Vips.ImageTest do
end
end

test "passing options as keyword" do
{:ok, im} = Image.new_from_file(img_path("puppies.jpg"))
# test "passing options as keyword" do
# {:ok, im} = Image.new_from_file(img_path("puppies.jpg"))

buf1 =
Image.write_to_stream(im, ".png", compression: 0)
|> Enum.into([])
# buf1 =
# Image.write_to_stream(im, ".png", compression: 0)
# |> Enum.into([])

{:ok, buf2} = Image.write_to_buffer(im, ".png", compression: 9)
# {:ok, buf2} = Image.write_to_buffer(im, ".png", compression: 9)

assert IO.iodata_length(buf1) > byte_size(buf2)
end
# assert IO.iodata_length(buf1) > byte_size(buf2)
# end

test "passing options as string" do
{:ok, im} = Image.new_from_file(img_path("puppies.jpg"))
# test "passing options as string" do
# {:ok, im} = Image.new_from_file(img_path("puppies.jpg"))

buf1 =
Image.write_to_stream(im, ".png[compression=0]")
|> Enum.into([])
# buf1 =
# Image.write_to_stream(im, ".png[compression=0]")
# |> Enum.into([])

{:ok, buf2} = Image.write_to_buffer(im, ".png", compression: 9)
# {:ok, buf2} = Image.write_to_buffer(im, ".png", compression: 9)

assert IO.iodata_length(buf1) > byte_size(buf2)
end
# assert IO.iodata_length(buf1) > byte_size(buf2)
# end
end

test "new_from_binary", %{dir: dir} do
Expand Down

0 comments on commit 0e97525

Please sign in to comment.