int main() { decltype(auto) i = f(); same_type<decltype(i),int&>(); decltype(auto) i2 = i; same_type<decltype(i2),int&>(); decltype(auto) i3 = ::i; same_type<decltype(i3),int>(); decltype(auto) i4 = (::i); same_type<decltype(i4),int&>(); decltype(auto) i5 = a.i; same_type<decltype(i5),int>(); decltype(auto) i6 = (a.i); same_type<decltype(i6),int&>(); decltype(auto) i7 = true ? ::i : ::i; same_type<decltype(i7),int&>(); same_type<decltype(g()),int&>(); same_type<decltype(h1()),int>(); same_type<decltype(h2()),int&>(); same_type<decltype(h2a()),int&>(); same_type<decltype(h3()),int>(); same_type<decltype(h4()),int&>(); same_type<decltype(h5(a)),int>(); same_type<decltype(h6(a)),int&>(); }
void draw_grid(int i,int j,int k) //This draws the grid and changes the color the grid according to the player { beginFrame(); Line h1(0,0,600,0),h2(0,100,600,100), // "h" is the horizontal lines and "v" is the vertical lines h3(0,200,600,200),h4(0,300,600,300), h5(0,400,600,400),h6(0,500,600,500), h7(0,600,600,600),h8(0,700,600,700), h9(0,800,600,800); Line v1(0,0,0,800),v2(100,0,100,800), v3(200,0,200,800),v4(300,0,300,800), v5(400,0,400,800),v6(500,0,500,800), v7(600,0,600,800); h1.setColor(COLOR(255*i,255*j,255*k)),h2.setColor(COLOR(255*i,255*j,255*k)), h3.setColor(COLOR(255*i,255*j,255*k)),h4.setColor(COLOR(255*i,255*j,255*k)), h5.setColor(COLOR(255*i,255*j,255*k)),h6.setColor(COLOR(255*i,255*j,255*k)), h7.setColor(COLOR(255*i,255*j,255*k)),h8.setColor(COLOR(255*i,255*j,255*k)), h9.setColor(COLOR(255*i,255*j,255*k)); v1.setColor(COLOR(255*i,255*j,255*k)),v2.setColor(COLOR(255*i,255*j,255*k)), v3.setColor(COLOR(255*i,255*j,255*k)),v4.setColor(COLOR(255*i,255*j,255*k)), v5.setColor(COLOR(255*i,255*j,255*k)),v6.setColor(COLOR(255*i,255*j,255*k)), v7.setColor(COLOR(255*i,255*j,255*k)); h1.imprint(),h2.imprint(), h3.imprint(),h4.imprint(), h5.imprint(),h6.imprint(), h7.imprint(),h8.imprint(),h9.imprint(); v1.imprint(),v2.imprint(), v3.imprint(),v4.imprint(), v5.imprint(),v6.imprint(),v7.imprint(); endFrame(); }
int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Sig_Handlers_Test")); ACE_Sig_Handlers multi_handlers; ACE_Select_Reactor reactor_impl (&multi_handlers); ACE_Reactor reactor (&reactor_impl); ACE_Reactor::instance (&reactor); // Create a bevy of handlers. Test_SIGINT_Handler h1 (ACE_Reactor::instance (), "h1"); Test_SIGINT_Handler h2 (ACE_Reactor::instance (), "h2"); Test_SIGINT_Handler h3 (ACE_Reactor::instance (), "h3"); Test_SIGINT_Handler h4 (ACE_Reactor::instance (), "h4"); Test_SIGINT_Handler h5 (ACE_Reactor::instance (), "h5"); Test_SIGINT_Handler h6 (ACE_Reactor::instance (), "h6"); Test_SIGINT_Handler h7 (ACE_Reactor::instance (), "h7"); Test_SIGINT_Handler h8 (ACE_Reactor::instance (), "h8"); Test_SIGINT_Shutdown_Handler h0 (ACE_Reactor::instance ()); // Wait for user to type SIGINT. while (!ACE_Reactor::instance ()->reactor_event_loop_done ()) { ACE_DEBUG ((LM_DEBUG,"\nwaiting for SIGINT\n")); if (ACE_Reactor::instance ()->handle_events () == -1) ACE_ERROR ((LM_ERROR,"%p\n","handle_events")); } ACE_END_TEST; return 0; }
int main() { Sac<int> s; Sac<Horloge> b1(4); s+= 4; s+= 6; s+= 9; s+= 8; IterateurSac<int> it(s); int somme; cout << "Itérateur de sac avec un sac de int" << endl; for(somme=0; !it; ++it){ somme += *it; cout << "Élément: " << *it << endl; } cout << "la somme de tous les éléments est: " << somme << endl << endl; Horloge h1(16,2,4,0); Horloge h2(5,22,56,0); Horloge h3(7,15,8,0); Horloge h4(19,7,14,0); Horloge h5(55,9,5,0); Horloge h6(1,21,22,0); b1+= h1; b1+= h2; b1+= h3; b1+= h4; b1+= h5; b1+= h6; cout << "Itérateur de sac avec un sac d'horloge" << endl; IterateurSac<Horloge> it2(b1); for(; !it2; ++it2){ cout << "Horloge: " << *it2 << endl; } system("PAUSE"); return 0; }
void test01() { { String on1; on1 = "//atp:77/root/cimv25:" "TennisPlayer.last=\"Rafter\",first=\"Patrick\""; String on2; on2 = "//atp:77/root/cimv25:" "TennisPlayer.first=\"Patrick\",last=\"Rafter\""; CIMObjectPath r = on1; PEGASUS_TEST_ASSERT(r.toString() != on1); PEGASUS_TEST_ASSERT(r.toString() == on2); CIMObjectPath r2 = r; CIMObjectPath r3 = CIMObjectPath ("//atp:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); if (verbose) { XmlWriter::printValueReferenceElement(r, false); cout << r.toString() << endl; } Buffer mofOut; MofWriter::appendValueReferenceElement(mofOut, r); r.clear(); } { CIMObjectPath r1 = CIMObjectPath ("MyClass.z=true,y=1234,x=\"Hello World\""); CIMObjectPath r2 = CIMObjectPath ("myclass.X=\"Hello World\",Z=true,Y=1234"); CIMObjectPath r3 = CIMObjectPath ("myclass.X=\"Hello\",Z=true,Y=1234"); // cout << r1.toString() << endl; // cout << r2.toString() << endl; PEGASUS_TEST_ASSERT(r1 == r2); PEGASUS_TEST_ASSERT(r1 != r3); } // Test case independence and order independence of parameters. { CIMObjectPath r1 = CIMObjectPath ("X.a=123,b=true"); CIMObjectPath r2 = CIMObjectPath ("x.B=TRUE,A=123"); PEGASUS_TEST_ASSERT(r1 == r2); PEGASUS_TEST_ASSERT(r1.makeHashCode() == r2.makeHashCode()); CIMObjectPath r3 = CIMObjectPath ("x.B=TRUE,A=123,c=FALSE"); PEGASUS_TEST_ASSERT(r1 != r3); String keyValue; Array<CIMKeyBinding> kbArray; { Boolean found = false; kbArray = r3.getKeyBindings(); for (Uint32 i = 0; i < kbArray.size(); i++) { if (verbose) { cout << "keyName= " << kbArray[i].getName().getString() << " Value= " << kbArray[i].getValue() << endl; } if ( kbArray[i].getName() == CIMName ("B") ) { keyValue = kbArray[i].getValue(); if(keyValue == "TRUE") found = true; } } if(!found) { cerr << "Key Binding Test error " << endl; exit(1); } //ATTN: KS 12 May 2002 P3 DEFER - keybinding manipulation. too // simplistic. // This code demonstrates that it is not easy to manipulate and // test keybindings. Needs better tool both in CIMObjectPath and // separate. } } // Test building from component parts of CIM Reference. { CIMObjectPath r1 ("atp:77", CIMNamespaceName ("root/cimv25"), CIMName ("TennisPlayer")); CIMObjectPath r2 ("//atp:77/root/cimv25:TennisPlayer."); //cout << "r1 " << r1.toString() << endl; //cout << "r2 " << r2.toString() << endl; PEGASUS_TEST_ASSERT(r1 == r2); PEGASUS_TEST_ASSERT(r1.toString() == r2.toString()); } { String hostName = "atp:77"; String nameSpace = "root/cimv2"; String className = "tennisplayer"; CIMObjectPath r1; r1.setHost(hostName); r1.setNameSpace(nameSpace); r1.setClassName(className); PEGASUS_TEST_ASSERT(r1.getClassName().equal(CIMName ("TENNISPLAYER"))); PEGASUS_TEST_ASSERT(!r1.getClassName().equal(CIMName ("blob"))); String newHostName = r1.getHost(); //cout << "HostName = " << newHostName << endl; CIMObjectPath r2 (hostName, nameSpace, className); PEGASUS_TEST_ASSERT(r1 == r2); } // Test cases for the Hostname. CIMObjectPaths allows the // host to include the domain. Eg. xyz.company.com // First, try a good hostname CIMObjectPath h0("//usoPen-9.ustA-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h1("//usoPen-9:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h2("//usoPen-9/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h3("//usoPen-9.ustA-1-a.org:0/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h4("//usoPen-9.ustA-1-a.org:9876/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h5("//usoPen-9.ustA-1-a.org:65535/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h6("//usopen-9.usta-1-a.1org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h7("//192.168.1.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h8("//192.168.0.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h9("//192.168.1.80.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h10("//192.168.0.80.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h11("//192.168.1.80.255.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h12("//192.168.0.80.254.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h13("//192.168.257.80.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h14("//192.256.0.80.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h15("//localhost/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h16("//ou812/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h17("//u812/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); // Hostname with '_' character support checks, see bug#2556. CIMObjectPath h18("//_atp:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h19("//a_tp/_root/_cimv25:_TennisPlayer"); CIMObjectPath h20("//atp_:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h21("//atp_-9:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h22( "//_a_t_p_-9.ustA-1-a.org:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h23("//_/root/cimv25:_TennisPlayer"); CIMObjectPath h24("//_______/root/cimv25:_TennisPlayer"); // try IPAddress as hostname which should be good CIMObjectPath h_ip0("//192.168.1.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h_ip1("//192.168.0.255/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); // Try IPv6 Addresses. CIMObjectPath ip6_1("//[::1]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath ip6_2("//[::ffff:192.1.2.3]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath ip6_3("//[fffe:233:321:234d:e45:fad4:78:12]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath ip6_4("//[fffe::]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); Boolean errorDetected = false; // Invalid IPV6 Addresses try { // IPv6 addresses must be enclosed in brackets CIMObjectPath ip6_mb("//fffe::12ef:127/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // IPv6 address invalid CIMObjectPath ip6_invalid("//[fffe::sd:77]/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //Port number out of range. CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:9876543210/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //Port number out of range. CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:65536/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //Port number out of range. CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:100000/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //more than three digits in an octect CIMObjectPath h_ErrIp0("//192.1600008.1.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Octet out of range CIMObjectPath op("//192.168.256.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Missing port is okay, needs be ignored CIMObjectPath op("//192.168.1.80:/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(!errorDetected); errorDetected = false; try { // Too many octets CIMObjectPath op("//192.168.1.80.12/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Too few octets CIMObjectPath op("//192.168.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Missing port is okay, needs be ignored CIMObjectPath op("//usopen-9.usta-1-a.org:/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(!errorDetected); errorDetected = false; try { // Hostname (IP) without trailing '/' (with port) CIMObjectPath op("//192.168.256.80:77"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Hostname (IP) without trailing '/' (without port) CIMObjectPath op("//192.168.256.80"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Hostname without trailing '/' (with port) CIMObjectPath op("//usopen-9.usta-1-a.org:77"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Hostname without trailing '/' (without port) CIMObjectPath op("//usopen-9.usta-1-a.org"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Invalid first character CIMObjectPath op("//+usopen-9.usta-1-a.1org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Non-alphanum char (?) CIMObjectPath op("//usopen-9.usta?-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Leading dot CIMObjectPath op("//.usopen-9.usta-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Dot in the wrong spot (before a -) CIMObjectPath op("//usopen.-9.usta-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Two dots in a row CIMObjectPath op("//usopen-9.usta-1-a..org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Trailing dot CIMObjectPath op("//usopen-9.usta-1-a.org.:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); }
/* --std=c90 -Wv */ void f1(void) { int i; struct tag { int x; } x; int *p; i(); x(); p(); } void f2(void) { void h2(int, double); void g2(); h2(0, 1); g2(0, 1); } /* prototype vs. non-prototype */ void f3(void) { struct tag { int x; } h3(void), x; int g3(void), y; x = h3(); y = g3(); } /* struct vs. non-struct */ void f4(void) { struct tag h4(void); h4(); } /* error - incomplete return */ void f5(void) { void h5(int, double); void g5(void); h5(0, 1); g5(); } /* argument vs. no argument */ void f6(void) { struct tag; void h6(struct tag); struct tag *p; h6(*p); } /* error - incomplete argument */
MarkdownEdit::MarkdownEdit(LiteApi::IApplication *app, LiteApi::IEditor *editor, QObject *parent) : QObject(parent), m_liteApp(app) { m_editor = LiteApi::getTextEditor(editor); if (!m_editor) { return; } m_ed = LiteApi::getPlainTextEdit(editor); if (!m_ed) { return; } m_ed->setLineWrapMode(QPlainTextEdit::WidgetWidth); LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Markdown"); QAction *h1 = new QAction(QIcon("icon:markdown/images/h1.png"),tr("Header (h1)"),this); actionContext->regAction(h1,"Header1","Ctrl+1"); QAction *h2 = new QAction(QIcon("icon:markdown/images/h2.png"),tr("Header (h2)"),this); actionContext->regAction(h2,"Header2","Ctrl+2"); QAction *h3 = new QAction(QIcon("icon:markdown/images/h3.png"),tr("Header (h3)"),this); actionContext->regAction(h3,"Header3","Ctrl+3"); QAction *h4 = new QAction(QIcon("icon:markdown/images/h4.png"),tr("Header (h4)"),this); actionContext->regAction(h4,"Header4","Ctrl+4"); QAction *h5 = new QAction(QIcon("icon:markdown/images/h5.png"),tr("Header (h5)"),this); actionContext->regAction(h5,"Header5","Ctrl+5"); QAction *h6 = new QAction(QIcon("icon:markdown/images/h6.png"),tr("Header (h6)"),this); actionContext->regAction(h6,"Header6","Ctrl+6"); QAction *bold = new QAction(QIcon("icon:markdown/images/bold.png"),tr("Bold"),this); actionContext->regAction(bold,"Bold",QKeySequence::Bold); QAction *italic = new QAction(QIcon("icon:markdown/images/italic.png"),tr("Italic"),this); actionContext->regAction(italic,"Italic",QKeySequence::Italic); QAction *code = new QAction(QIcon("icon:markdown/images/code.png"),tr("Inline Code"),this); actionContext->regAction(code,"InlineCode","Ctrl+K"); QAction *link = new QAction(QIcon("icon:markdown/images/link.png"),tr("Link"),this); actionContext->regAction(link,"Link","Ctrl+Shift+L"); QAction *image = new QAction(QIcon("icon:markdown/images/image.png"),tr("Image"),this); actionContext->regAction(image,"Image","Ctrl+Shift+I"); QAction *ul = new QAction(QIcon("icon:markdown/images/ul.png"),tr("Unordered List"),this); actionContext->regAction(ul,"UnorderedList","Ctrl+Shift+U"); QAction *ol = new QAction(QIcon("icon:markdown/images/ol.png"),tr("Ordered List"),this); actionContext->regAction(ol,"OrderedList","Ctrl+Shift+O"); QAction *bq = new QAction(QIcon("icon:markdown/images/quote.png"),tr("Blockquote"),this); actionContext->regAction(bq,"Blockquote","Ctrl+Shift+Q"); QAction *hr = new QAction(QIcon("icon:markdown/images/hr.png"),tr("Horizontal Rule"),this); actionContext->regAction(hr,"HorizontalRule","Ctrl+Shift+H"); QToolBar *toolBar = LiteApi::findExtensionObject<QToolBar*>(editor,"LiteApi.QToolBar"); QMenu *menu = LiteApi::getEditMenu(editor); if (menu) { menu->addSeparator(); QMenu *h = menu->addMenu(tr("Heading")); h->addAction(h1); h->addAction(h2); h->addAction(h3); h->addAction(h4); h->addAction(h5); h->addAction(h6); menu->addSeparator(); menu->addAction(link); menu->addAction(image); menu->addSeparator(); menu->addAction(bold); menu->addAction(italic); menu->addAction(code); menu->addSeparator(); menu->addAction(ul); menu->addAction(ol); menu->addSeparator(); menu->addAction(bq); menu->addAction(hr); } menu = LiteApi::getContextMenu(editor); if (menu) { menu->addSeparator(); menu->addAction(link); menu->addAction(image); menu->addSeparator(); menu->addAction(bold); menu->addAction(italic); menu->addAction(code); menu->addSeparator(); menu->addAction(ul); menu->addAction(ol); menu->addSeparator(); menu->addAction(bq); menu->addAction(hr); } if (toolBar) { toolBar->addSeparator(); toolBar->addAction(h1); toolBar->addAction(h2); toolBar->addAction(h3); toolBar->addSeparator(); toolBar->addAction(link); toolBar->addAction(image); toolBar->addSeparator(); toolBar->addAction(bold); toolBar->addAction(italic); toolBar->addAction(code); toolBar->addSeparator(); toolBar->addAction(ul); toolBar->addAction(ol); toolBar->addSeparator(); toolBar->addAction(bq); toolBar->addAction(hr); //updateToolTip(toolBar); } connect(editor,SIGNAL(destroyed()),this,SLOT(deleteLater())); connect(h1,SIGNAL(triggered()),this,SLOT(h1())); connect(h2,SIGNAL(triggered()),this,SLOT(h2())); connect(h3,SIGNAL(triggered()),this,SLOT(h3())); connect(h4,SIGNAL(triggered()),this,SLOT(h4())); connect(h5,SIGNAL(triggered()),this,SLOT(h5())); connect(h6,SIGNAL(triggered()),this,SLOT(h6())); connect(bold,SIGNAL(triggered()),this,SLOT(bold())); connect(italic,SIGNAL(triggered()),this,SLOT(italic())); connect(code,SIGNAL(triggered()),this,SLOT(code())); connect(link,SIGNAL(triggered()),this,SLOT(link())); connect(image,SIGNAL(triggered()),this,SLOT(image())); connect(ul,SIGNAL(triggered()),this,SLOT(ul())); connect(ol,SIGNAL(triggered()),this,SLOT(ol())); connect(bq,SIGNAL(triggered()),this,SLOT(bq())); connect(hr,SIGNAL(triggered()),this,SLOT(hr())); //m_ed->installEventFilter(this); }
void TestStelSphericalGeometry::testSphericalCap() { Vec3d p0(1.,0.,0.); Vec3d p1(-1.,0.,0.); Vec3d p2(1.,1.,1.); p2.normalize(); Vec3d p3(0.,1.,0.); SphericalCap h0(p0, 0.); SphericalCap h1(p0, 0.8); SphericalCap h2(p0, -0.5); SphericalCap h3(p1, 0.5); SphericalCap h4(p2, 0.8); SphericalCap h5(p2, 1.); SphericalCap h6(p1, 0.); QVERIFY2(h0.contains(p0), "SphericalCap contains point failure"); QVERIFY2(h1.contains(p0), "SphericalCap contains point failure"); QVERIFY2(h0.contains(p3), "SphericalCap contains point on the edge failure"); QVERIFY2(h6.contains(p3), "SphericalCap contains point on the edge failure"); QVERIFY(h0.intersects(h1)); QVERIFY(h0.intersects(h2)); QVERIFY(h1.intersects(h2)); QVERIFY(h4.intersects(h1)); QVERIFY(!h0.intersects(h3)); QVERIFY(!h1.intersects(h3)); QVERIFY(h2.intersects(h3)); QVERIFY(h0.intersects(h5)); QVERIFY(h0.intersects(h0)); QVERIFY(h1.intersects(h1)); QVERIFY(h2.intersects(h2)); QVERIFY(h3.intersects(h3)); QVERIFY(h4.intersects(h4)); QVERIFY(h5.intersects(h5)); QVERIFY(h6.intersects(h0)); QVERIFY(h0.intersects(h6)); QVERIFY(h0.contains(h1)); QVERIFY(!h1.contains(h0)); QVERIFY(h2.contains(h0)); QVERIFY(!h0.contains(h2)); QVERIFY(!h6.contains(h0)); QVERIFY(!h0.contains(h6)); QVERIFY(h2.contains(h1)); QVERIFY(!h1.contains(h2)); QVERIFY(!h0.contains(h3)); QVERIFY(!h1.contains(h3)); QVERIFY(h0.contains(h5)); QVERIFY(h2.contains(h5)); QVERIFY(!h5.contains(h0)); QVERIFY(!h5.contains(h1)); QVERIFY(!h5.contains(h2)); QVERIFY(!h5.contains(h3)); QVERIFY(!h5.contains(h4)); QVERIFY(h0.contains(h0)); QVERIFY(h1.contains(h1)); QVERIFY(h2.contains(h2)); QVERIFY(h3.contains(h3)); QVERIFY(h4.contains(h4)); QVERIFY(h5.contains(h5)); }