Lines Matching defs:gr
33 SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
34 if ( gr ) {
35 UTEST_ASSERT(gr->gradientTransform.isIdentity());
36 UTEST_ASSERT(gr->gradientTransform == Geom::identity());
37 g_object_unref(gr);
55 SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
56 SP_OBJECT(gr)->document = _doc;
58 SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "translate(5, 8)");
59 TS_ASSERT_EQUALS( gr->gradientTransform, Geom::Affine(Geom::Translate(5, 8)) );
61 SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "");
62 TS_ASSERT_EQUALS( gr->gradientTransform, Geom::identity() );
64 SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "rotate(90)");
65 TS_ASSERT_EQUALS( gr->gradientTransform, Geom::Affine(rotate_degrees(90)) );
67 g_object_unref(gr);
73 SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
74 SP_OBJECT(gr)->document = _doc;
76 SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "matrix(0, 1, -1, 0, 0, 0)");
79 SP_OBJECT(gr)->updateRepr(repr, SP_OBJECT_WRITE_ALL);
88 g_object_unref(gr);
94 SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
95 SP_OBJECT(gr)->document = _doc;
99 gr->gradientTransform = grXform;
102 Geom::Affine const g2d(sp_gradient_get_g2d_matrix(gr, Geom::identity(), unit_rect));
103 Geom::Affine const gs2d(sp_gradient_get_gs2d_matrix(gr, Geom::identity(), unit_rect));
105 TS_ASSERT( Geom::are_near(gs2d, gr->gradientTransform * g2d, 1e-12) );
107 sp_gradient_set_gs2d_matrix(gr, Geom::identity(), unit_rect, gs2d);
108 TS_ASSERT( Geom::are_near(gr->gradientTransform, grXform, 1e-12) );
111 gr->gradientTransform = grXform;
116 Geom::Affine const g2d(sp_gradient_get_g2d_matrix(gr, funny, unit_rect));
117 Geom::Affine const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, unit_rect));
119 TS_ASSERT( Geom::are_near(gs2d, gr->gradientTransform * g2d, 1e-12) );
121 sp_gradient_set_gs2d_matrix(gr, funny, unit_rect, gs2d);
122 TS_ASSERT( Geom::are_near(gr->gradientTransform, grXform, 1e-12) );
125 gr->gradientTransform = grXform;
128 Geom::Affine const g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
129 Geom::Affine const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
133 TS_ASSERT( Geom::are_near(gs2d, gr->gradientTransform * g2d, 1e-12) );
135 sp_gradient_set_gs2d_matrix(gr, funny, larger_rect, gs2d);
136 TS_ASSERT( Geom::are_near(gr->gradientTransform, grXform, 1e-12) );
138 SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTUNITS, "userSpaceOnUse");
139 Geom::Affine const user_g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
140 Geom::Affine const user_gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
142 TS_ASSERT( Geom::are_near(user_gs2d, gr->gradientTransform * user_g2d, 1e-12) );
144 g_object_unref(gr);