Mercurial > hg > orthanc
comparison UnitTestsSources/Png.cpp @ 710:c87a1d529e13
test pngreader
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Feb 2014 15:11:11 +0100 |
parents | 6c90ce085261 |
children | 8f62e8d5a384 |
comparison
equal
deleted
inserted
replaced
709:6c90ce085261 | 710:c87a1d529e13 |
---|---|
110 | 110 |
111 { | 111 { |
112 Orthanc::PngReader r; | 112 Orthanc::PngReader r; |
113 r.ReadFromMemory(s); | 113 r.ReadFromMemory(s); |
114 | 114 |
115 ASSERT_EQ(r.GetFormat(), Orthanc::PixelFormat_Grayscale16); | |
115 ASSERT_EQ(r.GetWidth(), width); | 116 ASSERT_EQ(r.GetWidth(), width); |
116 ASSERT_EQ(r.GetHeight(), height); | 117 ASSERT_EQ(r.GetHeight(), height); |
117 | 118 |
118 v = 0; | 119 v = 0; |
119 for (int y = 0; y < height; y++) | 120 for (int y = 0; y < height; y++) |
125 } | 126 } |
126 } | 127 } |
127 } | 128 } |
128 | 129 |
129 { | 130 { |
130 Toolbox::TemporaryFile tmp; | 131 Orthanc::Toolbox::TemporaryFile tmp; |
131 Toolbox::WriteFile(s, tmp.GetPath()); | 132 Orthanc::Toolbox::WriteFile(s, tmp.GetPath()); |
132 | 133 |
133 Orthanc::PngReader r2; | 134 Orthanc::PngReader r2; |
134 r2.ReadFromFile(tmp.GetPath()); | 135 r2.ReadFromFile(tmp.GetPath()); |
135 | 136 |
137 ASSERT_EQ(r2.GetFormat(), Orthanc::PixelFormat_Grayscale16); | |
136 ASSERT_EQ(r2.GetWidth(), width); | 138 ASSERT_EQ(r2.GetWidth(), width); |
137 ASSERT_EQ(r2.GetHeight(), height); | 139 ASSERT_EQ(r2.GetHeight(), height); |
140 | |
141 v = 0; | |
138 for (int y = 0; y < height; y++) | 142 for (int y = 0; y < height; y++) |
139 { | 143 { |
140 uint16_t *p = reinterpret_cast<uint16_t*>((uint8_t*) r2.GetBuffer() + y * r2.GetPitch()); | 144 uint16_t *p = reinterpret_cast<uint16_t*>((uint8_t*) r2.GetBuffer() + y * r2.GetPitch()); |
141 for (int x = 0; x < width; x++, p++, v++) | 145 for (int x = 0; x < width; x++, p++, v++) |
142 { | 146 { |