When pixels are of type double, as is the cas for your data_test, intensities are assumed to be in the range 0-1. Anything below 0 is considered the same as 0, anything above 1 is considered to be 1.
Thus, when you save your data_test as double, it is just converted to: [1 1 1 1; 1 1 0 1;1 1 0 1; 1 1 1 1]. As PNG images don't support double pixels, it is then converted to uint8. Hence why, you get the result back as uint8.
Note that im2uint8 produces the same result:
Now, the uint8 function is not designed for images but just for plain number, and will convert any number in the range 0-255 to unsigned 8 bit integer with the same value. Therefore there is no clipping. Compare the above with:
In conclusion, if your pixels are indeed uint8, declare them as so, otherwise matlab will consider them to range from 0 to 1.