00001 <?php 00002 $rubrique = 65; 00003 $meta_description = "QExtend: Fichier source de recentmenu.cpp"; 00004 $meta_keywords =" QExtend: Fichier source de recentmenu.cpp"; 00005 $titre_page = "QExtend"; 00006 $urlCss = "http://www.developpez.com/template/kit/article.css"; 00007 $xhtml=true; 00008 $Auteur=""; 00009 $Licence="4"; 00010 $Annee="2010"; 00011 $topicType = 'Whitepaper'; 00012 $meta = '<link rel="stylesheet" type="text/css" media="screen" href="https://www.developpez.com/public/css/index2.css" /><link rel="stylesheet" type="text/css" media="screen" href="tabs.css" /><link rel="stylesheet" type="text/css" media="screen" href="doxygen.css" />'; 00013 include($_SERVER["DOCUMENT_ROOT"]."/template/entete.php"); 00014 00015 ob_start(); 00016 ?> 00017 <!-- Généré par Doxygen 1.7.1 --> 00018 <div class="navigation" id="top"> 00019 <div class="tabs"> 00020 <ul class="tablist"> 00021 <li><a href="index.php"><span>Page principale</span></a></li> 00022 <li><a href="namespaces.php"><span>Espaces de nommage</span></a></li> 00023 <li><a href="annotated.php"><span>Classes</span></a></li> 00024 <li class="current"><a href="files.php"><span>Fichiers</span></a></li> 00025 </ul> 00026 </div> 00027 <div class="tabs2"> 00028 <ul class="tablist"> 00029 <li><a href="files.php"><span>Liste des fichiers</span></a></li> 00030 </ul> 00031 </div> 00032 <div class="header"> 00033 <div class="headertitle"> 00034 <h1>recentmenu.cpp</h1> </div> 00035 </div> 00036 <div class="contents"> 00037 <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> 00038 <a name="l00002"></a>00002 <span class="comment">Copyright © 2010 guillaume belz</span> 00039 <a name="l00003"></a>00003 <span class="comment"></span> 00040 <a name="l00004"></a>00004 <span class="comment">This file is part of QExtend.</span> 00041 <a name="l00005"></a>00005 <span class="comment"></span> 00042 <a name="l00006"></a>00006 <span class="comment">QExtend is free software: you can redistribute it and/or modify</span> 00043 <a name="l00007"></a>00007 <span class="comment">it under the terms of the GNU General Public License as published by</span> 00044 <a name="l00008"></a>00008 <span class="comment">the Free Software Foundation, either version 3 of the License, or</span> 00045 <a name="l00009"></a>00009 <span class="comment">any later version.</span> 00046 <a name="l00010"></a>00010 <span class="comment"></span> 00047 <a name="l00011"></a>00011 <span class="comment">QExtend is distributed in the hope that it will be useful,</span> 00048 <a name="l00012"></a>00012 <span class="comment">but WITHOUT ANY WARRANTY; without even the implied warranty of</span> 00049 <a name="l00013"></a>00013 <span class="comment">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> 00050 <a name="l00014"></a>00014 <span class="comment">GNU General Public License for more details.</span> 00051 <a name="l00015"></a>00015 <span class="comment"></span> 00052 <a name="l00016"></a>00016 <span class="comment">You should have received a copy of the GNU General Public License</span> 00053 <a name="l00017"></a>00017 <span class="comment">along with QExtend. If not, see <http://www.gnu.org/licenses/>.</span> 00054 <a name="l00018"></a>00018 <span class="comment">*/</span> 00055 <a name="l00019"></a>00019 00056 <a name="l00020"></a>00020 <span class="preprocessor">#include <QtTest/QtTest></span> 00057 <a name="l00021"></a>00021 <span class="preprocessor">#include <QExtend/Gui/RecentMenu></span> 00058 <a name="l00022"></a>00022 00059 <a name="l00023"></a><a class="code" href="classtest_recent_menu.php">00023</a> <span class="keyword">class </span><a class="code" href="classtest_recent_menu.php">testRecentMenu</a> : <span class="keyword">public</span> QObject 00060 <a name="l00024"></a>00024 { 00061 <a name="l00025"></a>00025 Q_OBJECT 00062 <a name="l00026"></a>00026 00063 <a name="l00027"></a>00027 <span class="keyword">private</span> slots: 00064 <a name="l00028"></a>00028 <span class="keywordtype">void</span> initTestCase(); 00065 <a name="l00029"></a>00029 <span class="keywordtype">void</span> maxSize(); 00066 <a name="l00030"></a>00030 <span class="keywordtype">void</span> clearItem(); 00067 <a name="l00031"></a>00031 <span class="keywordtype">void</span> cleanupTestCase(); 00068 <a name="l00032"></a>00032 <span class="keywordtype">void</span> addRecent(); 00069 <a name="l00033"></a>00033 00070 <a name="l00034"></a>00034 <span class="keyword">private</span>: 00071 <a name="l00035"></a>00035 <a class="code" href="class_q_extend_1_1_recent_menu.php" title="Une classe de test.">QExtend::RecentMenu</a> *menu; 00072 <a name="l00036"></a>00036 }; 00073 <a name="l00037"></a>00037 00074 <a name="l00038"></a>00038 <span class="keywordtype">void</span> testRecentMenu::initTestCase() 00075 <a name="l00039"></a>00039 { 00076 <a name="l00040"></a>00040 menu = <span class="keyword">new</span> <a class="code" href="class_q_extend_1_1_recent_menu.php" title="Une classe de test.">QExtend::RecentMenu</a>(<span class="stringliteral">"recent menu"</span>); 00077 <a name="l00041"></a>00041 <span class="keywordflow">if</span>(!menu) 00078 <a name="l00042"></a>00042 qDebug() << <span class="stringliteral">"Error in QExtend::RecentMenu(QString&, QWidget*)."</span>; 00079 <a name="l00043"></a>00043 } 00080 <a name="l00044"></a>00044 00081 <a name="l00045"></a>00045 <span class="keywordtype">void</span> testRecentMenu::maxSize() 00082 <a name="l00046"></a>00046 { 00083 <a name="l00047"></a>00047 menu-><a class="code" href="class_q_extend_1_1_recent_menu.php#abf3f04c47b01e3329b6b80ed901fd582">setMaxSize</a>(123456); 00084 <a name="l00048"></a>00048 QVERIFY(menu-><a class="code" href="class_q_extend_1_1_recent_menu.php#a18912470e4e27416c220f67d523a7744">maxSize</a>() == 123456); 00085 <a name="l00049"></a>00049 } 00086 <a name="l00050"></a>00050 00087 <a name="l00051"></a>00051 <span class="keywordtype">void</span> testRecentMenu::clearItem() 00088 <a name="l00052"></a>00052 { 00089 <a name="l00053"></a>00053 menu-><a class="code" href="class_q_extend_1_1_recent_menu.php#a28b404710afb8b8cbefe7769d006698c">setClearItem</a>(<span class="keyword">true</span>); 00090 <a name="l00054"></a>00054 QVERIFY(menu-><a class="code" href="class_q_extend_1_1_recent_menu.php#a959bc642846a94a928664233d28a47b0">clearItem</a>()); 00091 <a name="l00055"></a>00055 } 00092 <a name="l00056"></a>00056 00093 <a name="l00057"></a>00057 <span class="keywordtype">void</span> testRecentMenu::addRecent() 00094 <a name="l00058"></a>00058 { 00095 <a name="l00059"></a>00059 QList<QAction*> actions = menu->findChildren<QAction*>(); 00096 <a name="l00060"></a>00060 QVERIFY(actions.size() == 1); 00097 <a name="l00061"></a>00061 QVERIFY(actions[0]->text() == <span class="stringliteral">"recent menu"</span>); 00098 <a name="l00062"></a>00062 00099 <a name="l00063"></a>00063 menu-><a class="code" href="class_q_extend_1_1_recent_menu.php#adeefb300959ec5a670366a840489b9e3">addRecent</a>(<span class="stringliteral">"filename"</span>); 00100 <a name="l00064"></a>00064 00101 <a name="l00065"></a>00065 actions = menu->findChildren<QAction*>(); 00102 <a name="l00066"></a>00066 QVERIFY(actions.size() == 4); 00103 <a name="l00067"></a>00067 QVERIFY(actions[0]->text() == <span class="stringliteral">"recent menu"</span>); 00104 <a name="l00068"></a>00068 QVERIFY(actions[1]->text() == <span class="stringliteral">"filename"</span>); 00105 <a name="l00069"></a>00069 QVERIFY(actions[2]->text() == <span class="stringliteral">""</span>); 00106 <a name="l00070"></a>00070 QVERIFY(actions[3]->text() == <span class="stringliteral">"Clear list"</span>); 00107 <a name="l00071"></a>00071 } 00108 <a name="l00072"></a>00072 00109 <a name="l00073"></a>00073 <span class="keywordtype">void</span> testRecentMenu::cleanupTestCase() 00110 <a name="l00074"></a>00074 { 00111 <a name="l00075"></a>00075 <span class="comment">//delete menu;</span> 00112 <a name="l00076"></a>00076 } 00113 <a name="l00077"></a>00077 00114 <a name="l00078"></a>00078 QTEST_MAIN(<a class="code" href="classtest_recent_menu.php">testRecentMenu</a>) 00115 <a name="l00079"></a>00079 <span class="preprocessor">#include "recentmenu.moc"</span> 00116 </pre></div></div> 00117 </div> 00118 <?php 00119 echo utf8_decode(ob_get_clean()); 00120 include($_SERVER["DOCUMENT_ROOT"]."/template/pied.php"); 00121 ?>
Les sources présentées sur cette page sont libres de droits et vous pouvez les utiliser à votre convenance. Par contre, la page de présentation constitue une œuvre intellectuelle protégée par les droits d'auteur. Copyright © 2010 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site ni de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon vous encourez selon la loi jusqu'à trois ans de prison et jusqu'à 300 000 € de dommages et intérêts.