- Fix rgba2hex - Add testspull/3882/head
parent
f15dcfa981
commit
2a6b84c8ea
|
@ -54,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cstdlib>
|
||||
#include <locale>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define AI_SIZEFMT "%Iu"
|
||||
|
@ -176,7 +177,7 @@ AI_FORCE_INLINE std::string ai_rgba2hex(int r, int g, int b, int a, bool with_he
|
|||
if (with_head) {
|
||||
ss << "#";
|
||||
}
|
||||
ss << std::hex << (r << 24 | g << 16 | b << 8 | a);
|
||||
ss << std::hex << std::setfill('0') << std::setw(8) << (r << 24 | g << 16 | b << 8 | a);
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Assimp</author>
|
||||
<authoring_tool>Assimp Exporter</authoring_tool>
|
||||
</contributor>
|
||||
<created>2021-05-05T14:41:31</created>
|
||||
<modified>2021-05-05T14:41:31</modified>
|
||||
<unit name="meter" meter="1" />
|
||||
<up_axis>Y_UP</up_axis>
|
||||
</asset>
|
||||
<library_images>
|
||||
</library_images>
|
||||
<library_effects>
|
||||
<effect id="material_0-fx" name="">
|
||||
<profile_COMMON>
|
||||
<technique sid="standard">
|
||||
<phong>
|
||||
<diffuse>
|
||||
<color sid="diffuse">1 0 0 1</color>
|
||||
</diffuse>
|
||||
<transparency>
|
||||
<float sid="transparency">0.0373546556</float>
|
||||
</transparency>
|
||||
</phong>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="material_0" name="">
|
||||
<instance_effect url="#material_0-fx"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="mesh_0" name="" >
|
||||
<mesh>
|
||||
<source id="mesh_0-positions" name="mesh_0-positions">
|
||||
<float_array id="mesh_0-positions-array" count="9"> 1 0 0 0 1 0 0 0 1 </float_array>
|
||||
<technique_common>
|
||||
<accessor count="3" offset="0" source="#mesh_0-positions-array" stride="3">
|
||||
<param name="X" type="float" />
|
||||
<param name="Y" type="float" />
|
||||
<param name="Z" type="float" />
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="mesh_0-vertices">
|
||||
<input semantic="POSITION" source="#mesh_0-positions" />
|
||||
</vertices>
|
||||
<polylist count="1" material="defaultMaterial">
|
||||
<input offset="0" semantic="VERTEX" source="#mesh_0-vertices" />
|
||||
<vcount>3 </vcount>
|
||||
<p>0 1 2 </p>
|
||||
</polylist>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_controllers>
|
||||
</library_controllers>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="Scene" name="Scene">
|
||||
<node id="node" name="" type="NODE">
|
||||
<matrix sid="matrix">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
|
||||
<instance_geometry url="#mesh_0">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="defaultMaterial" target="#material_0">
|
||||
</instance_material>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#Scene" />
|
||||
</scene>
|
||||
</COLLADA>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,33 @@
|
|||
solid Assimp_Pointcloud
|
||||
facet normal 0 0 0
|
||||
vertex 0 0 0
|
||||
vertex 0 0 0
|
||||
vertex 0 0 0
|
||||
vertex 1 1 1
|
||||
vertex 1 1 1
|
||||
vertex 1 1 1
|
||||
vertex 2 2 2
|
||||
vertex 2 2 2
|
||||
vertex 2 2 2
|
||||
vertex 3 3 3
|
||||
vertex 3 3 3
|
||||
vertex 3 3 3
|
||||
vertex 4 4 4
|
||||
vertex 4 4 4
|
||||
vertex 4 4 4
|
||||
vertex 5 5 5
|
||||
vertex 5 5 5
|
||||
vertex 5 5 5
|
||||
vertex 6 6 6
|
||||
vertex 6 6 6
|
||||
vertex 6 6 6
|
||||
vertex 7 7 7
|
||||
vertex 7 7 7
|
||||
vertex 7 7 7
|
||||
vertex 8 8 8
|
||||
vertex 8 8 8
|
||||
vertex 8 8 8
|
||||
vertex 9 9 9
|
||||
vertex 9 9 9
|
||||
vertex 9 9 9
|
||||
endsolid Assimp_Pointcloud
|
|
@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/StringUtils.h>
|
||||
|
||||
class utStringUtils : public ::testing::Test {
|
||||
// empty
|
||||
};
|
||||
|
||||
TEST_F(utStringUtils, to_string_Test ) {
|
||||
|
@ -66,3 +67,11 @@ TEST_F( utStringUtils, ai_strtofTest ) {
|
|||
res = ai_strtof( begin, end );
|
||||
EXPECT_FLOAT_EQ( res, 200.0f );
|
||||
}
|
||||
|
||||
TEST_F(utStringUtils, ai_rgba2hexTest) {
|
||||
std::string result;
|
||||
result = ai_rgba2hex(255, 255, 255, 255, true);
|
||||
EXPECT_EQ(result, "#ffffffff");
|
||||
result = ai_rgba2hex(0, 0, 0, 0, false);
|
||||
EXPECT_EQ(result, "00000000");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue