| 59 | |
| 60 | template<typename TransformType> |
| 61 | void check_qtvector_transform(const TransformType&) |
| 62 | { |
| 63 | typedef typename TransformType::MatrixType MatrixType; |
| 64 | TransformType x(MatrixType::Random()), y(MatrixType::Random()); |
| 65 | QVector<TransformType> v(10), w(20, y); |
| 66 | v[5] = x; |
| 67 | w[6] = v[5]; |
| 68 | VERIFY_IS_APPROX(w[6], v[5]); |
| 69 | v = w; |
| 70 | for(int i = 0; i < 20; i++) |
| 71 | { |
| 72 | VERIFY_IS_APPROX(w[i], v[i]); |
| 73 | } |
| 74 | |
| 75 | v.resize(21); |
| 76 | v[20] = x; |
| 77 | VERIFY_IS_APPROX(v[20], x); |
| 78 | v.fill(y,22); |
| 79 | VERIFY_IS_APPROX(v[21], y); |
| 80 | v.push_back(x); |
| 81 | VERIFY_IS_APPROX(v[22], x); |
| 82 | VERIFY((size_t)&(v[22]) == (size_t)&(v[21]) + sizeof(TransformType)); |
| 83 | |
| 84 | // do a lot of push_back such that the vector gets internally resized |
| 85 | // (with memory reallocation) |
| 86 | TransformType* ref = &w[0]; |
| 87 | for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i) |
| 88 | v.push_back(w[i%w.size()]); |
| 89 | for(unsigned int i=23; int(i)<v.size(); ++i) |
| 90 | { |
| 91 | VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix()); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | template<typename QuaternionType> |
| 96 | void check_qtvector_quaternion(const QuaternionType&) |