~azzar1/nux/fix-893670

« back to all changes in this revision

Viewing changes to tests/test_object.cpp

  • Committer: Tim Penhey
  • Date: 2011-11-11 03:00:48 UTC
  • mfrom: (450.3.3 objectptr-getpointer)
  • Revision ID: tim.penhey@canonical.com-20111111030048-djs7n0e8zdlbkvy3
Change the smart pointer's GetPointer method so there is only one that returns a non const T*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
  EXPECT_THAT(a->GetReferenceCount(), Eq(1));
153
153
}
154
154
 
 
155
TEST(TestObject, TestObjectPtrGetPointer) {
 
156
 
 
157
  OwnedObject* a = new OwnedObject(NUX_TRACKER_LOCATION);  // ref count = 1, owned
 
158
  nux::ObjectPtr<OwnedObject> object_ptr;
 
159
  object_ptr.Adopt(a);
 
160
 
 
161
  EXPECT_THAT(object_ptr.GetPointer(), Eq(a));
 
162
  // Const too
 
163
  nux::ObjectPtr<OwnedObject> const& object_ptr_ref = object_ptr;
 
164
  EXPECT_THAT(object_ptr_ref.GetPointer(), Eq(a));
 
165
}
 
166
 
155
167
TEST(TestObject, TestObjectPtr1) {
156
168
 
157
169
  ChildOwnedObject *c = new ChildOwnedObject (NUX_TRACKER_LOCATION);  // ref count = 1, owned