A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQTest</id>
		<title>C++/Qt/QTest - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQTest"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTest&amp;action=history"/>
		<updated>2026-04-18T22:14:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTest&amp;diff=1060&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTest&amp;diff=1060&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTest&amp;diff=1061&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTest&amp;diff=1061&amp;oldid=prev"/>
				<updated>2010-05-25T10:24:42Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Qt Unit test==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter16\classdata\datetest.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QtTest&amp;gt;&lt;br /&gt;
#include &amp;lt;QDate&amp;gt;&lt;br /&gt;
#include &amp;quot;datetest.h&amp;quot;&lt;br /&gt;
void DateTest::testAdd()&lt;br /&gt;
{&lt;br /&gt;
  QDate date( 1979, 5, 16 );&lt;br /&gt;
  &lt;br /&gt;
  QFETCH( int, addYear );&lt;br /&gt;
  QFETCH( int, addMonth );&lt;br /&gt;
  QFETCH( int, addDay );&lt;br /&gt;
  &lt;br /&gt;
  QDate next = date.addYears( addYear ).addMonths( addMonth ).addDays( addDay );&lt;br /&gt;
  &lt;br /&gt;
  QTEST( next.year(), &amp;quot;year&amp;quot; );&lt;br /&gt;
  QTEST( next.month(), &amp;quot;month&amp;quot; );&lt;br /&gt;
  QTEST( next.day(), &amp;quot;day&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
void DateTest::testAdd_data ()&lt;br /&gt;
{&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;addYear&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;addMonth&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;addDay&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;year&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;month&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;day&amp;quot; );&lt;br /&gt;
    &lt;br /&gt;
  QTest::newRow( &amp;quot;Start date&amp;quot; )    &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 1979 &amp;lt;&amp;lt; 5 &amp;lt;&amp;lt; 16;&lt;br /&gt;
  QTest::newRow( &amp;quot;One day&amp;quot; )       &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 1 &amp;lt;&amp;lt; 1979 &amp;lt;&amp;lt; 5 &amp;lt;&amp;lt; 17;&lt;br /&gt;
  QTest::newRow( &amp;quot;Twenty days&amp;quot; )   &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 20 &amp;lt;&amp;lt; 1979 &amp;lt;&amp;lt; 6 &amp;lt;&amp;lt; 5;&lt;br /&gt;
  QTest::newRow( &amp;quot;366 days&amp;quot; )      &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 366 &amp;lt;&amp;lt; 1980 &amp;lt;&amp;lt; 5 &amp;lt;&amp;lt; 16;&lt;br /&gt;
  QTest::newRow( &amp;quot;One month&amp;quot; )     &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 1 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 1979 &amp;lt;&amp;lt; 6 &amp;lt;&amp;lt; 16;&lt;br /&gt;
  QTest::newRow( &amp;quot;Twelve months&amp;quot; ) &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 12 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 1980 &amp;lt;&amp;lt; 5 &amp;lt;&amp;lt; 16;&lt;br /&gt;
  QTest::newRow( &amp;quot;28 years&amp;quot; )      &amp;lt;&amp;lt; 28 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 0 &amp;lt;&amp;lt; 2007 &amp;lt;&amp;lt; 5 &amp;lt;&amp;lt; 16;&lt;br /&gt;
}&lt;br /&gt;
void DateTest::testValid()&lt;br /&gt;
{&lt;br /&gt;
  QFETCH( int, year );&lt;br /&gt;
  QFETCH( int, month );&lt;br /&gt;
  QFETCH( int, day );&lt;br /&gt;
  &lt;br /&gt;
  QDate date( year, month, day );&lt;br /&gt;
  QTEST( date.isValid(), &amp;quot;valid&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
void DateTest::testValid_data()&lt;br /&gt;
{&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;year&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;month&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;int&amp;gt;( &amp;quot;day&amp;quot; );&lt;br /&gt;
  QTest::addColumn&amp;lt;bool&amp;gt;( &amp;quot;valid&amp;quot; );&lt;br /&gt;
    &lt;br /&gt;
  QTest::newRow( &amp;quot;Valid, normal&amp;quot; ) &amp;lt;&amp;lt; 1973 &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; 16 &amp;lt;&amp;lt; true;&lt;br /&gt;
  QTest::newRow( &amp;quot;Invalid, normal&amp;quot; ) &amp;lt;&amp;lt; 1973 &amp;lt;&amp;lt; 9 &amp;lt;&amp;lt; 31 &amp;lt;&amp;lt; false;&lt;br /&gt;
  QTest::newRow( &amp;quot;Valid, leap-year&amp;quot; ) &amp;lt;&amp;lt; 1980 &amp;lt;&amp;lt; 2 &amp;lt;&amp;lt; 29 &amp;lt;&amp;lt; true;&lt;br /&gt;
  QTest::newRow( &amp;quot;Invalid, leap-year&amp;quot; ) &amp;lt;&amp;lt; 1981 &amp;lt;&amp;lt; 2 &amp;lt;&amp;lt; 29 &amp;lt;&amp;lt; false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter16\classdata\datetest.h&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#ifndef DATETEST_H&lt;br /&gt;
#define DATETEST_H&lt;br /&gt;
#include &amp;lt;QObject&amp;gt;&lt;br /&gt;
class DateTest : public QObject&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
  &lt;br /&gt;
private slots:&lt;br /&gt;
  void testAdd();&lt;br /&gt;
  void testAdd_data();&lt;br /&gt;
  &lt;br /&gt;
  void testValid();&lt;br /&gt;
  void testValid_data();&lt;br /&gt;
};&lt;br /&gt;
#endif // DATETEST_H&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter16\classdata\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QtTest&amp;gt;&lt;br /&gt;
#include &amp;quot;datetest.h&amp;quot;&lt;br /&gt;
QTEST_MAIN( DateTest )&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>