Skip to content

Commit 7d4af16

Browse files
committed
tests: get set image type
1 parent 06908c1 commit 7d4af16

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ Generates an SHA-256 message digest for the image pixel stream.
698698
-----
699699
Gets the image ticks-per-second.
700700

701-
`img:get_image_type()`
701+
`img:get_type()`
702702
-----
703703
Gets the potential image type:
704704

lib/resty/imagick/wand/base.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,8 @@ _M.get_ticks_per_second = function(self)
836836
return lib.MagickGetImageTicksPerSecond(self.wand)
837837
end
838838

839-
_M.get_image_type = function(self)
840-
return image_type:to_str(lib.MagickGetImageType(self.wand))
839+
_M.get_type = function(self)
840+
return image_type():to_str(lib.MagickGetImageType(self.wand))
841841
end
842842

843843
_M.get_units = function(self)
@@ -881,7 +881,7 @@ _M.identify = function(self)
881881
end
882882

883883
_M.identify_type = function(self)
884-
return image_type:to_str(lib.MagickIdentifyImageType(self.wand))
884+
return image_type():to_str(lib.MagickIdentifyImageType(self.wand))
885885
end
886886

887887
_M.implode = function(self, radius, method)
@@ -1261,7 +1261,7 @@ end
12611261

12621262
_M.set_type = function(self, itype)
12631263
return handle_result(self, lib.MagickSetImageType(self.wand,
1264-
image_type:to_int(itype .. "Type")))
1264+
image_type():to_int(itype .. "Type")))
12651265
end
12661266

12671267
_M.set_units = function(self, units)

spec/002-attr.lua

+9
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,13 @@ describe("ImageAttr", function()
6363
cs = img:get_colorspace()
6464
assert.truthy(cs == "RGBColorspace")
6565
end)
66+
67+
it("getSetImageType", function()
68+
local it = img:get_type()
69+
assert.is_true(it == "TrueColorAlphaType")
70+
71+
img:set_type("Bilevel")
72+
it = img:get_type()
73+
assert.is_true(it == "BilevelType")
74+
end)
6675
end)

0 commit comments

Comments
 (0)