// Testing get/set functions
void tst_QAbstractPrintDialog::getSetCheck()
{
    QPrinter printer;
    MyAbstractPrintDialog obj1(&printer);
    QCOMPARE(obj1.printer(), &printer);
    // PrintDialogOptions QAbstractPrintDialog::enabledOptions()
    // void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions)
    obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::None));
    QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::None), obj1.enabledOptions());
    obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintToFile));
    QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintToFile), obj1.enabledOptions());
    obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintSelection));
    QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintSelection), obj1.enabledOptions());
    obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintPageRange));
    QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintPageRange), obj1.enabledOptions());
    obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintCollateCopies));
    QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintCollateCopies), obj1.enabledOptions());

    // PrintRange QAbstractPrintDialog::printRange()
    // void QAbstractPrintDialog::setPrintRange(PrintRange)
    obj1.setPrintRange(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::AllPages));
    QCOMPARE(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::AllPages), obj1.printRange());
    obj1.setPrintRange(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::Selection));
    QCOMPARE(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::Selection), obj1.printRange());
    obj1.setPrintRange(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::PageRange));
    QCOMPARE(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::PageRange), obj1.printRange());
}
Пример #2
0
int main()
{
	boost::asio::io_service ioService;
	boost::asio::io_service::work work(ioService);

	std::vector<std::thread> threads;
	for (auto thread : IRange<uint8_t>(1, std::thread::hardware_concurrency()))
	{
		threads.push_back(std::thread(
			[&ioService]()
			{
				ioService.run();
			}));
	}

	Countdown obj1(ioService, "One", 10);
	Countdown obj2(ioService, "Two", 12);

	obj1.start();
	obj2.start();

	for (auto& thread : threads)
	{
		thread.join();
	}

	return 0;
}
Пример #3
0
void tst_QSqlError::construction()
{
   QSqlError obj1("drivertext", "databasetext", QSqlError::UnknownError, 123);
   QCOMPARE(obj1.driverText(), QString("drivertext"));
   QCOMPARE(obj1.databaseText(), QString("databasetext"));
   QCOMPARE(obj1.type(), QSqlError::UnknownError);
   QCOMPARE(obj1.number(), 123);
   obj1.isValid();

   QSqlError obj2(obj1);
   QCOMPARE(obj2.driverText(), obj1.driverText());
   QCOMPARE(obj2.databaseText(), obj1.databaseText());
   QCOMPARE(obj2.type(), obj1.type());
   QCOMPARE(obj2.number(), obj1.number());
   QVERIFY(obj2.isValid());

   QSqlError obj3 = obj2;
   QCOMPARE(obj3.driverText(), obj2.driverText());
   QCOMPARE(obj3.databaseText(), obj2.databaseText());
   QCOMPARE(obj3.type(), obj2.type());
   QCOMPARE(obj3.number(), obj2.number());
   QVERIFY(obj3.isValid());

   QSqlError obj4;
   QVERIFY(!obj4.isValid());
}
bool TestTransferObject()
{
    JS::RootedObject obj1(cx, CreateNewObject(8, 12));
    CHECK(obj1);
    JS::RootedValue v1(cx, JS::ObjectValue(*obj1));

    // Create an Array of transferable values.
    JS::AutoValueVector argv(cx);
    if (!argv.append(v1))
        return false;

    JS::RootedObject obj(cx, JS_NewArrayObject(cx, JS::HandleValueArray::subarray(argv, 0, 1)));
    CHECK(obj);
    JS::RootedValue transferable(cx, JS::ObjectValue(*obj));

    JSAutoStructuredCloneBuffer cloned_buffer(JS::StructuredCloneScope::SameProcessSameThread, nullptr, nullptr);
    CHECK(cloned_buffer.write(cx, v1, transferable, nullptr, nullptr));
    JS::RootedValue v2(cx);
    CHECK(cloned_buffer.read(cx, &v2, nullptr, nullptr));
    JS::RootedObject obj2(cx, v2.toObjectOrNull());
    CHECK(VerifyObject(obj2, 8, 12, true));
    CHECK(JS_IsDetachedArrayBufferObject(obj1));

    return true;
}
Пример #5
0
int _tmain(int argc, _TCHAR* argv[])
{
	{
		Test obj1(10);
		obj1.ShowData();

		cout << "Adress of object: " << &obj1 << endl;

		Test obj2(obj1);
		obj2.ShowData();
		cout << "Adress of object: " << &obj2 << endl;

		Test obj3 = obj1;
		obj3.SetData(777);
		obj3.ShowData();
		cout << "Adress of object: " << &obj3 << endl;

		cout << "====================================\n";
		function1(obj1);
		obj1.ShowData();
	}
	{
		cout << "====================================\n";
		Test obj4 = function2();
		obj4.ShowData();

	}
	system("pause");
	return 0;
}
    /*!
     * @brief unregisterObject()メソッドとfind()メソッドのテスト
     * 
     * - オブジェクトをunregisterObject()で登録解除して、そのオブジェクトを正しく取得できるか?
     * - 登録解除したオブジェクトのIDを指定してfind()した場合、意図どおりNULLを得るか?
     * - 登録解除していないオブジェクトは、依然としてfind()で正しく取得できるか?
     */
    void test_unregisterObject_and_find()
    {
      ::ObjectManager<std::string, ObjectMock, PredicateMock> objMgr;
    	
      // オブジェクトを準備しておく
      ObjectMock obj1("ID 1");
      ObjectMock obj2("ID 2");

      // オブジェクトを登録する
      CPPUNIT_ASSERT_EQUAL(true, objMgr.registerObject(&obj1));
      CPPUNIT_ASSERT_EQUAL(true, objMgr.registerObject(&obj2));
			
      // オブジェクトを登録解除して、そのオブジェクトを正しく取得できるか?
      ObjectMock* pObjRet1 = objMgr.unregisterObject("ID 1");
      CPPUNIT_ASSERT(pObjRet1 != NULL);
      CPPUNIT_ASSERT_EQUAL(std::string("ID 1"), pObjRet1->getId());
			
      // 登録解除したオブジェクトのIDを指定してfind()した場合、意図どおりNULLを得るか?
      CPPUNIT_ASSERT_EQUAL((ObjectMock*) NULL, objMgr.find("ID 1"));
			
      // 登録解除していないオブジェクトは、依然としてfind()で正しく取得できるか?
      ObjectMock* pObjRet2 = objMgr.find("ID 2");
      CPPUNIT_ASSERT(pObjRet2 != NULL);
      CPPUNIT_ASSERT_EQUAL(std::string("ID 2"), pObjRet2->getId());
    }
Пример #7
0
void snippet_locations()
{
//! [13]
    QSettings obj1("MySoft", "Star Runner");
//! [13] //! [14]
    QSettings obj2("MySoft");
    QSettings obj3(QSettings::SystemScope, "MySoft", "Star Runner");
    QSettings obj4(QSettings::SystemScope, "MySoft");
//! [14]

    {
//! [15]
    QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                       "MySoft", "Star Runner");
//! [15]
    }

    {
    QSettings settings("starrunner.ini", QSettings::IniFormat);
    }

    {
    QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft",
                       QSettings::NativeFormat);
    }
}
Пример #8
0
TEST(AmfObjectTraitsTest, Equality) {
	AmfObjectTraits obj1("foo", false, true);
	AmfObjectTraits obj2("foo", false, false);
	AmfObjectTraits obj3("foo", true, false);
	AmfObjectTraits obj4("foo", false, false);
	AmfObjectTraits obj5("bar", false, true);
	AmfObjectTraits obj1e("foo", false, true);

	EXPECT_NE(obj1, obj2);
	EXPECT_NE(obj1, obj3);
	EXPECT_NE(obj1, obj4);
	EXPECT_NE(obj1, obj5);
	EXPECT_EQ(obj1, obj1e);

	// Verify attributes are also compared.
	obj1.addAttribute("attr");
	EXPECT_NE(obj1, obj1e);

	obj1e.addAttribute("attr");
	EXPECT_EQ(obj1, obj1e);

	// Verify attributes can't be duplicated.
	obj1.addAttribute("attr");
	EXPECT_EQ(obj1, obj1e);
}
// Testing get/set functions
void tst_QTextObject::getSetCheck()
{
    QTextEdit edit;
    QTextFrame obj1(edit.document());
    // QTextFrameLayoutData * QTextFrame::layoutData()
    // void QTextFrame::setLayoutData(QTextFrameLayoutData *)
    QTextFrameLayoutData *var1 = new QTextFrameLayoutData;
    obj1.setLayoutData(var1);
    QCOMPARE(var1, obj1.layoutData());
    obj1.setLayoutData((QTextFrameLayoutData *)0);
    QCOMPARE((QTextFrameLayoutData *)0, obj1.layoutData());
    // delete var1; // No delete, since QTextFrame takes ownership

    QTextBlock obj2 = edit.textCursor().block();
    // QTextBlockUserData * QTextBlock::userData()
    // void QTextBlock::setUserData(QTextBlockUserData *)
    QTextBlockUserData *var2 = new QTextBlockUserData;
    obj2.setUserData(var2);
    QCOMPARE(var2, obj2.userData());
    obj2.setUserData((QTextBlockUserData *)0);
    QCOMPARE((QTextBlockUserData *)0, obj2.userData());

    // int QTextBlock::userState()
    // void QTextBlock::setUserState(int)
    obj2.setUserState(0);
    QCOMPARE(0, obj2.userState());
    obj2.setUserState(INT_MIN);
    QCOMPARE(INT_MIN, obj2.userState());
    obj2.setUserState(INT_MAX);
    QCOMPARE(INT_MAX, obj2.userState());
}
Пример #10
0
int main(int argc, char const *argv[])
{
	HasPtr obj1(new int, 1);
	HasPtr obj2 = obj1;
	HasPtr obj3(NULL, 1);
	obj3 = obj1;
	return 0;
}
void main (void)
{
    dois_gen<int, double> obj1(10,0.23);
    dois_gen<char, char *> obj2('X',"Isto e um teste.");

    obj1.exibe ();
    obj2.exibe ();
}
Пример #12
0
int main()
{
	plusminus obj1(4, 7) ;
	std::cout << "Printing obj1" << std::endl ;
	obj1.print();

//	-obj1 ;
//	std::cout << "Printing obj1" << std::endl ;
//	std::cout << obj1.getter1() << " " << obj1.getter2() << " " << std::endl ;
//	obj1.print();

	plusminus obj2(5, 1) ;
	std::cout << "Printing obj2" << std::endl ;
	obj2.print();
	
	
	std::cout << "Printing obj1 + obj2" << std::endl ;
	(obj1 + obj2).print();

	std::cout << "Printing obj1" << std::endl ;
	(obj1).print();

//	std::cout << "Printing obj3 - obj4" << std::endl ;
//	plusminus obj3(5 , 10);
//	plusminus obj4(10 , 10);
//	(obj3 - obj4).print() ;
	
	plusminus obj5(44, 23);
	plusminus obj6(11, 22);
	plusminus obj7(0, 0);

	obj7 = (obj5 - obj6) ;
	std::cout << "Printing obj7" << std::endl ;
	obj7.print();

	plusminus obj8 = -obj6 ;
	std::cout << "Printing obj8" << std::endl ;
	obj8.print();

	//	std::cout << "Printing -obj1" << std::endl ;
//	std::cout << -obj1.getter1() << " " << -obj1.getter2() << std::endl ;
//	(-obj1).print();
//	std::cout << std::endl ;

//	plusminus obj2 ;
//	obj2 = -obj1 ;
//	plusminus obj3 = -obj1 ;

//	std::cout << "Printing obj1" << std::endl ;
//	std::cout << obj1.getter1() << " " << obj1.getter2() << std::endl ;
//	std::cout << std::endl ;


//	std::cout << "Printing obj3" << std::endl ;
//	std::cout << obj3.getter1() << " " << obj.getter2() << std::endl ;
//	std::cout << std::endl ;
}
Пример #13
0
void main( )
{
	Test<int> obj1(10);
	obj1.SetValue(10);
	std::cout<<obj1.GetValue( )<<std::endl;

	Test<double> obj2(5.7);
	std::cout<<obj2.GetValue( )<<std::endl;
}
Пример #14
0
TEST_F(TesteLista, RetiraObj) {
	Objeto obj0(20);
	Objeto obj1(10);
	Objeto obj2(40);
	lobj.adiciona(obj0);
	lobj.adiciona(obj1);
	lobj.adiciona(obj2);
	ASSERT_EQ(lobj.retira(), obj2);

}
Пример #15
0
// Testing get/set functions
void tst_Q3Action::getSetCheck()
{
    Q3ActionGroup obj1(0);
    // bool Q3ActionGroup::usesDropDown()
    // void Q3ActionGroup::setUsesDropDown(bool)
    obj1.setUsesDropDown(false);
    QCOMPARE(false, obj1.usesDropDown());
    obj1.setUsesDropDown(true);
    QCOMPARE(true, obj1.usesDropDown());
}
Пример #16
0
TEST_F(TesteFila, UltimaPosicaoElementoComplexo){
	Objeto obj0(10);
	Objeto obj1(5);
	Objeto obj2(2);

	filaobj.inclui(obj0);
	filaobj.inclui(obj1);
	filaobj.inclui(obj2);
	ASSERT_EQ(2, fila.getUltimo());
}
TEST_F(TesteLista, retiraDoInicioDuplo) {
	Objeto obj0(20);
	Objeto obj1(10);
	Objeto obj2(40);
	lobj.adicionaDuplo(obj0);
	lobj.adicionaDuplo(obj1);
	lobj.adicionaDuplo(obj2);
	lobj.retiraDoInicioDuplo();
	ASSERT_EQ(lobj.retiraDoInicioDuplo(), obj1);
}
Пример #18
0
void main()
{
	Array<int> obj(5,5);
	try
	{ // inserting elements into array
        obj.insert(3,9);
	obj.insert(2,8);
	obj.insert(1,7);
	obj.insert(0,6);
	obj.insert(-1,5);
	
    // creating another object and trying out functions	
	Array<int> obj1(10,5);
	obj1=obj;
	obj.print();
	
	cout<<obj[5]<<endl;
	cout<<obj[6]<<endl;
	cout<<obj[7]<<endl;
	cout<<obj[8]<<endl;
	obj1.print(); // printing array
	obj1.bubble(); // bubble sort
	obj1.print(); // printing array
	cout<<obj.getBase()<<endl;
	obj.setBase(10);
	cout<<obj.getBase()<<endl;
	cout<<"Array has size "<<obj.getLength()<<endl;
	
	Array<int> obj2(6); // trying for the second array
	obj2.insert(3,0);
	obj2.insert(7,1);
	obj2.insert(3,5);
	obj2.insert(4,3);
	obj2.insert(2,2);
	
	// trying out function for the first derivative
	cout<<"Polynom: ";
	obj2.print();
	int stepen=2;
	Array<int> obj3(6);
	obj3.nThDerivative(obj2,stepen);
	cout<<stepen<<". nThDerivative:";
	obj3.print();
	
	/*Array<int> obj4(6);
	obj4=obj2.nThDerivative(1);
	obj4.print();*/
	}
	catch(char* e)
	{
		cout<<e<<endl;
	}
	
}
Пример #19
0
TEST(ObjectTest, test_circular_with_object_weak) {

    LifeCycleMock mock;
    EXPECT_CALL(mock, constructed()).Times(2);
    EXPECT_CALL(mock, destructed()).Times(2);

    TestObject::Ptr obj0(TestObject::New(&mock));
    TestObject::Ptr obj1(TestObject::New(&mock));

    obj0->set_other(obj1);
    obj1->set_other(obj0);
}
    /*!
     * @brief registerObject()メソッドのテスト
     * 
     * - オブジェクトを正常に登録できるか?
     */
    void test_registerObject()
    {
      ::ObjectManager<std::string, ObjectMock, PredicateMock> objMgr;

      // オブジェクトを準備しておく
      ObjectMock obj1("ID 1");
      ObjectMock obj2("ID 2");
			
      // オブジェクトを正常に登録できるか?
      CPPUNIT_ASSERT_EQUAL(true, objMgr.registerObject(&obj1));
      CPPUNIT_ASSERT_EQUAL(true, objMgr.registerObject(&obj2));
    }
Пример #21
0
  void test(Cls &c) {
    c.f(7);
    c.g(7);  // expected-note {{used here}}
    (void)static_cast<T1>(c);
    T2 t2 = c;
    T3 &t3 = c;
    (void)static_cast<T4>(c); // expected-note {{used here}}
    T5 t5 = c;  // expected-note {{used here}}
    T6 &t6 = c;  // expected-note {{used here}}

    Cls2 obj1((T7()));  // expected-note {{used here}}
  }
Пример #22
0
// Testing get/set functions
void tst_QLayout::getSetCheck()
{
    QBoxLayout obj1(QBoxLayout::LeftToRight);
    // QWidget * QLayout::menuBar()
    // void QLayout::setMenuBar(QWidget *)
    QMenuBar *var1 = new QMenuBar();
    obj1.setMenuBar(var1);
    QCOMPARE(static_cast<QWidget *>(var1), obj1.menuBar());
    obj1.setMenuBar((QWidget *)0);
    QCOMPARE((QWidget *)0, obj1.menuBar());
    delete var1;
}
Пример #23
0
int main()
{
    MyClass obj(5);
	obj.show();
	MyClass obj1(1);
	MyClass obj2(2);
	MyClass obj3(3);
	std::cout << "Done!" << std::endl;
	
	system("pause");
	return 0;
}
void tst_QAbstractPrintDialog::setMinMax()
{
    QPrinter printer;
    MyAbstractPrintDialog obj1(&printer);
    obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::None));
    QCOMPARE(obj1.minPage(), 1);
    QCOMPARE(obj1.maxPage(), INT_MAX);
    QVERIFY(!obj1.isOptionEnabled(QAbstractPrintDialog::PrintPageRange));
    obj1.setMinMax(2,5);
    QCOMPARE(obj1.minPage(), 2);
    QCOMPARE(obj1.maxPage(), 5);
    QVERIFY(obj1.enabledOptions() & QAbstractPrintDialog::PrintPageRange);
    QVERIFY(obj1.isOptionEnabled(QAbstractPrintDialog::PrintPageRange));
}
Пример #25
0
bool TestCloneObject()
{
    JS::RootedObject obj1(cx, CreateNewObject(8, 12));
    CHECK(obj1);
    JSAutoStructuredCloneBuffer cloned_buffer(JS::StructuredCloneScope::SameProcessSameThread, nullptr, nullptr);
    JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
    CHECK(cloned_buffer.write(cx, v1, nullptr, nullptr));
    JS::RootedValue v2(cx);
    CHECK(cloned_buffer.read(cx, &v2, nullptr, nullptr));
    JS::RootedObject obj2(cx, v2.toObjectOrNull());
    CHECK(VerifyObject(obj2, 8, 12, false));

    return true;
}
TEST_F(TesteLista, retiraEspecificoDuplo) {
	Objeto obj0(0);
	Objeto obj1(1);
	Objeto obj2(2);
	Objeto obj3(3);
	Objeto obj4(4);

	lobj.adicionaDuplo(obj0);
	lobj.adicionaDuplo(obj1);
	lobj.adicionaDuplo(obj2);
	lobj.adicionaDuplo(obj3);
	lobj.adicionaDuplo(obj4);
	ASSERT_EQ(lobj.retiraEspecificoDuplo(obj3), 3);
}
void tst_QAbstractPrintDialog::setFromTo()
{
    QPrinter printer;
    MyAbstractPrintDialog obj1(&printer);
    QCOMPARE(obj1.fromPage(), 0);
    QCOMPARE(obj1.toPage(), 0);
    obj1.setMinMax(0,0);
    QCOMPARE(obj1.minPage(), 0);
    QCOMPARE(obj1.maxPage(), 0);
    obj1.setFromTo(20,50);
    QCOMPARE(obj1.fromPage(), 20);
    QCOMPARE(obj1.toPage(), 50);
    QCOMPARE(obj1.minPage(), 1);
    QCOMPARE(obj1.maxPage(), 50);
}
    /*!
     * @brief registerObject()メソッドのテスト
     * 
     * - 同一のオブジェクト(当然、識別子も同じ)の登録を試みて、意図どおり失敗するか?
     * - 同一の識別子を持つ別のオブジェクトの登録を試みて、意図どおり失敗するか?
     */
    void test_registerObject_with_overlapped_identifier()
    {
      ::ObjectManager<std::string, ObjectMock, PredicateMock> objMgr;

      // 同一の識別子を持つオブジェクトを準備しておく
      ObjectMock obj1("ID");
      ObjectMock obj2("ID");

      // オブジェクトを登録する
      CPPUNIT_ASSERT_EQUAL(true, objMgr.registerObject(&obj1));
			
      // 同一のオブジェクト(当然、識別子も同じ)の登録を試みて、意図どおり失敗するか?
      CPPUNIT_ASSERT_EQUAL(false, objMgr.registerObject(&obj1));
			
      // 同一の識別子を持つ別のオブジェクトの登録を試みて、意図どおり失敗するか?
      CPPUNIT_ASSERT_EQUAL(false, objMgr.registerObject(&obj2));
    }
Пример #29
0
void main(int argc, char* argv[])
{
	Coord_2d obj1(1, 1, 2005), obj2;
	int x1, y1, t;

	cout << "Size of class= " << sizeof(Coord_2d) << endl << endl;

	obj1.getcord(x1, y1, t);
	cout << "Obj1`s address is " << &obj1 << endl;
	cout << "Obj1.x`s address is " << obj1.get_x_ptr() << endl;
	cout << "obj1.x= " << x1 << endl;
	cout << "obj1.y= " << y1 << endl;
	cout << "obj1.t= " << t << endl << endl;

	obj2.getcord(x1, y1, t);
	cout << "Obj2`s address is " << &obj2 << endl;
	cout << "Obj2.x`s address is " << obj2.get_x_ptr() << endl;
	cout << "obj2.x= " << x1 << endl;
	cout << "obj2.y= " << y1 << endl;
	cout << "obj2.t= " << t << endl << endl;
	
/*Здесь вызывается конструктор копирования по умолчанию СОЗДАННЫЙ КОМПИЛЯТОРОМ.
  Создаётся ПОБИТОВАЯ копия. Это значит, что ссылки и указатели, определённые в
  исходном классе, будут указывать на те же адреса.
  Если эти ссылки должны различаться в каждом объекте,нужно писать СВОИ 
  конструкторы копирования, желательно работающие через указатель, а не ссылку.*/
	Coord_2d obj3=obj1;
	obj3.getcord(x1, y1, t);
	cout << "Obj3`s address is " << &obj3 << endl;
	cout << "Obj3.x`s address is " << obj3.get_x_ptr() << endl;
	cout << "obj3.x= " << x1 << endl;
	cout << "obj3.y= " << y1 << endl;
	cout << "obj3.t= " << t << endl << endl;

/*ИДЕАЛЬНЫЙ ВАРИАНТ. Так и нужно делать. Прелесть в том, что сам указываешь,
  КАК понимать присвоение. В частности, куда должны указывать ссылки и указатели,
  находящиеся внутри объекта.*/
	Coord_2d obj4(&obj1);
	obj3.getcord(x1, y1, t);
	cout << "Obj4`s address is " << &obj4 << endl;
	cout << "Obj4.x`s address is " << obj4.get_x_ptr() << endl;
	cout << "obj4.x= " << x1 << endl;
	cout << "obj4.y= " << y1 << endl;
	cout << "obj4.t= " << t << endl << endl;
}
Пример #30
0
// Testing get/set functions
void tst_QDrag::getSetCheck()
{
    QDrag obj1(0);
    // QMimeData * QDrag::mimeData()
    // void QDrag::setMimeData(QMimeData *)
    QMimeData *var1 = new QMimeData;
    obj1.setMimeData(var1);
    QCOMPARE(var1, obj1.mimeData());
    obj1.setMimeData(var1);
    QCOMPARE(var1, obj1.mimeData());
    obj1.setMimeData((QMimeData *)0);
    QCOMPARE((QMimeData *)0, obj1.mimeData());
    // delete var1; // No delete, since QDrag takes ownership

    Qt::DropAction result = obj1.start();
    QCOMPARE(result, Qt::IgnoreAction);
    result = obj1.start(Qt::MoveAction | Qt::LinkAction);
    QCOMPARE(result, Qt::IgnoreAction);
}