Esempio n. 1
0
        public void TestEqualOperator()
        {
            var q  = new QDate(2014, 11, 22);
            var q2 = new QDate(2014, 11, 22);

            Assert.AreEqual(q, q2);
        }
Esempio n. 2
0
        public void TestShortDayNameDe()
        {
            var q1 = QDate.ShortDayName(1);

            Assert.AreEqual("Mo", q1);

            var q2 = QDate.ShortDayName(2);

            Assert.AreEqual("Di", q2);

            var q3 = QDate.ShortDayName(3);

            Assert.AreEqual("Mi", q3);

            var q4 = QDate.ShortDayName(4);

            Assert.AreEqual("Do", q4);

            var q5 = QDate.ShortDayName(5);

            Assert.AreEqual("Fr", q5);

            var q6 = QDate.ShortDayName(6);

            Assert.AreEqual("Sa", q6);

            var q7 = QDate.ShortDayName(7);

            Assert.AreEqual("So", q7);
        }
Esempio n. 3
0
 public void TestYear()
 {
     using (var q = new QDate(2014, 11, 20))
     {
         Assert.AreEqual(2014, q.Year);
     }
 }
Esempio n. 4
0
        public void TestShortDayNameEn()
        {
            var q1 = QDate.ShortDayName(1);

            Assert.AreEqual("Mon", q1);

            var q2 = QDate.ShortDayName(2);

            Assert.AreEqual("Tue", q2);

            var q3 = QDate.ShortDayName(3);

            Assert.AreEqual("Wed", q3);

            var q4 = QDate.ShortDayName(4);

            Assert.AreEqual("Thu", q4);

            var q5 = QDate.ShortDayName(5);

            Assert.AreEqual("Fri", q5);

            var q6 = QDate.ShortDayName(6);

            Assert.AreEqual("Sat", q6);

            var q7 = QDate.ShortDayName(7);

            Assert.AreEqual("Sun", q7);
        }
Esempio n. 5
0
        public void TestLongDayNameDe()
        {
            var q1 = QDate.LongDayName(1);

            Assert.AreEqual("Montag", q1);

            var q2 = QDate.LongDayName(2);

            Assert.AreEqual("Dienstag", q2);

            var q3 = QDate.LongDayName(3);

            Assert.AreEqual("Mittwoch", q3);

            var q4 = QDate.LongDayName(4);

            Assert.AreEqual("Donnerstag", q4);

            var q5 = QDate.LongDayName(5);

            Assert.AreEqual("Freitag", q5);

            var q6 = QDate.LongDayName(6);

            Assert.AreEqual("Samstag", q6);

            var q7 = QDate.LongDayName(7);

            Assert.AreEqual("Sonntag", q7);
        }
Esempio n. 6
0
        //-------------------------------------------------------------------//
        private static object ExcelDateArray2QDate(Array a)
        {
            var dim1 = a.GetLength(0);

            if (a.Rank == 1)
            {
                var res = new QDate[dim1];
                for (var i = 0; i < dim1; i++)
                {
                    res[i] = (QDate)ExcelDate2QDate(a.GetValue(i));
                }
                return(res);
            }
            var dim2 = a.GetLength(1);
            var r    = new object[dim2]; //two dimensional array

            for (var i = 0; i < dim2; i++)
            {
                var elem = new QDate[dim1];
                for (var j = 0; j < dim1; j++)
                {
                    elem[j] = (QDate)ExcelDate2QDate(a.GetValue(j, i));
                }
                r[i] = elem;
            }
            return(r);
        }
Esempio n. 7
0
 public void TestEmptyConstructor()
 {
     using (var s = new QDate())
     {
         Assert.NotNull(s.__Instance);
     }
 }
Esempio n. 8
0
        public void TestIsNull()
        {
            var q = new QDate(2002, 5, 17);

            Assert.IsFalse(q.IsNull);

            var q2 = new QDate(2002, 2, 30);

            Assert.IsTrue(q2.IsNull);

            var q3 = new QDate(2004, 2, 29);

            Assert.IsFalse(q3.IsNull);

            var q4 = new QDate(2000, 2, 29);

            Assert.IsFalse(q4.IsNull);

            var q5 = new QDate(2006, 2, 29);

            Assert.IsTrue(q5.IsNull);

            var q6 = new QDate(2100, 2, 29);

            Assert.IsTrue(q6.IsNull);

            var q7 = new QDate(1202, 6, 6);

            Assert.IsFalse(q7.IsNull);
        }
Esempio n. 9
0
        public void TestIsValid_StaticFunc()
        {
            var q = QDate.IsValid(2002, 5, 17);

            Assert.IsTrue(q);

            var q2 = QDate.IsValid(2002, 2, 30);

            Assert.IsFalse(q2);

            var q3 = QDate.IsValid(2004, 2, 29);

            Assert.IsTrue(q3);

            var q4 = QDate.IsValid(2000, 2, 29);

            Assert.IsTrue(q4);

            var q5 = QDate.IsValid(2006, 2, 29);

            Assert.IsFalse(q5);

            var q6 = QDate.IsValid(2100, 2, 29);

            Assert.IsFalse(q6);

            var q7 = QDate.IsValid(1202, 6, 6);

            Assert.IsTrue(q7);
        }
Esempio n. 10
0
        public void TestLongDayNameEn()
        {
            var q1 = QDate.LongDayName(1);

            Assert.AreEqual("Monday", q1);

            var q2 = QDate.LongDayName(2);

            Assert.AreEqual("Tuesday", q2);

            var q3 = QDate.LongDayName(3);

            Assert.AreEqual("Wednesday", q3);

            var q4 = QDate.LongDayName(4);

            Assert.AreEqual("Thursday", q4);

            var q5 = QDate.LongDayName(5);

            Assert.AreEqual("Friday", q5);

            var q6 = QDate.LongDayName(6);

            Assert.AreEqual("Saturday", q6);

            var q7 = QDate.LongDayName(7);

            Assert.AreEqual("Sunday", q7);
        }
            private void init()
            {
                long lastModified = _path.getLastModified();
                long length       = _path.getLength();

                _lastModified = lastModified;
                _length       = length;
                _canRead      = _path.canRead();
                _isDirectory  = _path.isDirectory();

                StringBuilder sb = new StringBuilder();

                sb.append('"');
                Base64.encode(sb, _path.getCrc64());
                sb.append('"');
                _etag = sb.ToString();

                QDate cal = QDate.allocateGmtDate();

                cal.setGMTTime(lastModified);
                _lastModifiedString = cal.printDate();

                QDate.freeGmtDate(cal);

                if (lastModified == 0)
                {
                    _canRead     = false;
                    _isDirectory = false;
                }
            }
Esempio n. 12
0
        public void TestToString()
        {
            var q = new QDate(1969, 07, 20);

            var s1 = q.ToString("dd.MM.yyyy");

            Assert.AreEqual("20.07.1969", s1);
        }
Esempio n. 13
0
        public void TestDateConstructor()
        {
            var s = new QDate(2014, 9, 20);

            Assert.AreEqual(2014, s.Year);
            Assert.AreEqual(9, s.Month);
            Assert.AreEqual(20, s.Day);
        }
Esempio n. 14
0
        public void TestFromStringWithStringFormat()
        {
            var d = QDate.FromString("1MM12car2003", "d'MM'MMcaryyyy");

            Assert.AreEqual(1, d.Day);
            Assert.AreEqual(12, d.Month);
            Assert.AreEqual(2003, d.Year);
        }
Esempio n. 15
0
        public void TestDateConstructor()
        {
            var s = new QDate(2014, 9, 20);

            Assert.AreEqual(2014, s.Year);
            Assert.AreEqual(9, s.Month);
            Assert.AreEqual(20, s.Day);
        }
Esempio n. 16
0
        public unsafe void TestWeekNumber()
        {
            var q = new QDate(2014, 11, 20);

            var week = q.WeekNumber();

            Assert.AreEqual(47, week);
        }
Esempio n. 17
0
 public void TestFromJulianDay()
 {
     using (var q = QDate.FromJulianDay(2456921))
     {
         Assert.AreEqual(this.qDate.Day, q.Day);
         Assert.AreEqual(this.qDate.Year, q.Year);
         Assert.AreEqual(this.qDate.Month, q.Month);
     }
 }
Esempio n. 18
0
        public void TestFromStringWithDateFormat()
        {
            var f = DateFormat.ISODate;
            var d = QDate.FromString("2014-09-20", f);

            Assert.AreEqual(20, d.Day);
            Assert.AreEqual(09, d.Month);
            Assert.AreEqual(2014, d.Year);
        }
Esempio n. 19
0
        public void TestFromJulianDay()
        {
            var q = QDate.FromJulianDay(2456921);
            var s = _qDate;

            Assert.AreEqual(_qDate.Day, q.Day);
            Assert.AreEqual(_qDate.Year, q.Year);
            Assert.AreEqual(_qDate.Month, q.Month);
        }
Esempio n. 20
0
        public void TestToStringWithDateFormat()
        {
            var f = DateFormat.ISODate;

            var q = new QDate(1969, 07, 20);

            var s1 = q.ToString(f);

            Assert.AreEqual("1969-07-20", s1);
        }
Esempio n. 21
0
 public void TestEqualOperator()
 {
     using (var q = new QDate(2014, 11, 22))
     {
         using (var q2 = new QDate(2014, 11, 22))
         {
             Assert.AreEqual(q, q2);
         }
     }
 }
Esempio n. 22
0
        public void TestLessEqualOperator()
        {
            var q  = new QDate(2014, 11, 21);
            var q2 = new QDate(2014, 11, 22);

            var res = (q <= q2); // true

            //Assert.LessOrEqual(q, q2);

            Assert.IsTrue(res);
        }
Esempio n. 23
0
        public void TestWeekNumber()
        {
            int week;

            using (var q = new QDate(2014, 11, 20))
            {
                week = q.WeekNumber();
            }

            Assert.AreEqual(47, week);
        }
Esempio n. 24
0
        public void TestToString()
        {
            string s1;

            using (var q = new QDate(1969, 07, 20))
            {
                s1 = q.ToString("dd.MM.yyyy");
            }

            Assert.AreEqual("20.07.1969", s1);
        }
Esempio n. 25
0
        public unsafe void TestGreaterEqualOperator()
        {
            var q  = new QDate(2014, 11, 23);
            var q2 = new QDate(2014, 11, 22);

            var res = (q >= q2); // true

            //Assert.GreaterOrEqual(q, q2);

            Assert.IsTrue(res);
        }
Esempio n. 26
0
        public void TestGreaterOperator()
        {
            var q  = new QDate(2014, 11, 20);
            var q2 = new QDate(2014, 11, 22);

            var res = (q > q2); // false

            //Assert.Greater(q, q2);

            Assert.IsFalse(res);
        }
Esempio n. 27
0
        public void TestLessOperator()
        {
            var q  = new QDate(2014, 11, 20);
            var q2 = new QDate(2014, 11, 22);

            var res = (q < q2); // true

            //Assert.Less(q, q2);

            Assert.IsTrue(res);
        }
Esempio n. 28
0
        public void testQDateFromString()
        {
            Assert.AreEqual(new QDate(-1645), QDate.FromString("1995.07.01"));
            Assert.AreEqual(new QDate(-365), QDate.FromString("1999.01.01"));
            Assert.AreEqual(new QDate(0), QDate.FromString("2000.01.01"));
            Assert.AreEqual(new QDate(2008), QDate.FromString("2005.07.01"));
            Assert.AreEqual(new QDate(3653), QDate.FromString("2010.01.01"));

            Assert.AreEqual(new QDate(int.MinValue), QDate.FromString(null));
            Assert.AreEqual(new QDate(int.MinValue), QDate.FromString(""));
            Assert.AreEqual(new QDate(int.MinValue), QDate.FromString("0Nd"));
        }
Esempio n. 29
0
        public void TestIsLeapYear()
        {
            var net = DateTime.IsLeapYear(2014);
            var q   = QDate.IsLeapYear(2014);

            Assert.AreEqual(net, q);

            var net2 = DateTime.IsLeapYear(2040);
            var q2   = QDate.IsLeapYear(2040);

            Assert.AreEqual(net2, q2);
        }
        protected DateTime(Env env, StringValue timeString, DateTimeZone dateTimeZone)
        {
            if (dateTimeZone == null)
            {
                dateTimeZone = new DateTimeZone(env);
            }

            _qDate        = new QDate(dateTimeZone.getTimeZone(), env.getCurrentTime());
            _dateTimeZone = dateTimeZone;

            init(env, timeString);
        }
        /**
         * Returns the days in a given month.
         */
        public static int cal_days_in_month(Env env,
                                            int cal, int month, int year)
        {
            QDate date = env.getDate();

            date.setGMTTime(env.getCurrentTime());

            date.setYear(year);
            date.setMonth(month - 1);

            return(date.getDaysInMonth());
        }
Esempio n. 32
0
 public virtual bool SetDate(QDate date, int year, int month, int day)
 {
     return (bool) interceptor.Invoke("setDate#$$$", "setDate(QDate&, int, int, int) const", typeof(bool), typeof(QDate), date, typeof(int), year, typeof(int), month, typeof(int), day);
 }
Esempio n. 33
0
 public void Append(QDate date)
 {
     interceptor.Invoke("append#", "append(const QDate&)", typeof(void), typeof(QDate), date);
 }
Esempio n. 34
0
 public Variant(QDate date)
     : this((Type) null)
 {
     CreateProxy();
     interceptor.Invoke("Variant#", "Variant(const QDate&)", typeof(void), typeof(QDate), date);
 }
Esempio n. 35
0
        public void TestDaysTo()
        {
            long res2;
            using (var q = new QDate(1995, 5, 17))
            {
                using (var q2 = new QDate(1995, 5, 20))
                {
                    var res1 = q.DaysTo(q2);
                    Assert.AreEqual(3, res1);

                    res2 = q2.DaysTo(q);
                }
            }
            Assert.AreEqual(-3, res2);
        }
Esempio n. 36
0
 public void Test_Day_DayOfWeek_DayOfYear_Month_Year()
 {
     var net = new DateTime(2014, 09, 20);
     using (var q = new QDate(2014, 09, 20))
     {
         Assert.AreEqual(net.Day, q.Day);
         Assert.AreEqual(net.Month, q.Month);
         Assert.AreEqual(net.Year, q.Year);
         Assert.AreEqual((int)net.DayOfWeek, q.DayOfWeek);
         Assert.AreEqual(net.DayOfYear, q.DayOfYear);
         Assert.AreEqual(DateTime.DaysInMonth(2014, 09), q.DaysInMonth);
         Assert.AreEqual((new DateTime(2014, 12, 31).Subtract(new DateTime(2014, 01, 01)).TotalDays) + 1, q.DaysInYear);
     }
 }
Esempio n. 37
0
 public virtual string WeekDayName(QDate date)
 {
     return (string) interceptor.Invoke("weekDayName#", "weekDayName(const QDate&) const", typeof(string), typeof(QDate), date);
 }
Esempio n. 38
0
 public virtual string MonthName(QDate date)
 {
     return (string) interceptor.Invoke("monthName#", "monthName(const QDate&) const", typeof(string), typeof(QDate), date);
 }
Esempio n. 39
0
        public void TestToString()
        {
            string s1;
            using (var q = new QDate(1969, 07, 20))
            {
                s1 = q.ToString("dd.MM.yyyy");
            }

            Assert.AreEqual("20.07.1969", s1);
        }
Esempio n. 40
0
 public void TestNotEqualOperator()
 {
     using (var q = new QDate(2014, 11, 20))
     {
         using (var q2 = new QDate(2014, 11, 22))
         {
             Assert.AreNotEqual(q, q2);
         }
     }
 }
Esempio n. 41
0
        public void TestLessOperator()
        {
            bool res; // true
            using (var q = new QDate(2014, 11, 20))
            {
                using (var q2 = new QDate(2014, 11, 22))
                {
                    res = (q < q2);
                }
            }

            //Assert.Less(q, q2);

            Assert.IsTrue(res);
        }
Esempio n. 42
0
 public void Init()
 {
     this.qDate = new QDate(2014, 9, 20);
 }
Esempio n. 43
0
        public void TestIsNull()
        {
            using (var q = new QDate(2002, 5, 17))
            {
                Assert.IsFalse(q.IsNull);
            }

            using (var q2 = new QDate(2002, 2, 30))
            {
                Assert.IsTrue(q2.IsNull);
            }

            using (var q3 = new QDate(2004, 2, 29))
            {
                Assert.IsFalse(q3.IsNull);
            }

            using (var q4 = new QDate(2000, 2, 29))
            {
                Assert.IsFalse(q4.IsNull);
            }

            using (var q5 = new QDate(2006, 2, 29))
            {
                Assert.IsTrue(q5.IsNull);
            }

            using (var q6 = new QDate(2100, 2, 29))
            {
                Assert.IsTrue(q6.IsNull);
            }

            using (var q7 = new QDate(1202, 6, 6))
            {
                Assert.IsFalse(q7.IsNull);
            }
        }
Esempio n. 44
0
 public virtual string MonthString(QDate pDate)
 {
     return (string) interceptor.Invoke("monthString#", "monthString(const QDate&) const", typeof(string), typeof(QDate), pDate);
 }
Esempio n. 45
0
File: Qt.cs Progetto: KDE/qyoto
 public static QDataStream Read(QDataStream arg1, QDate arg2)
 {
     return (QDataStream) staticInterceptor.Invoke("operator>>##", "operator>>(QDataStream&, QDate&)", typeof(QDataStream), typeof(QDataStream), arg1, typeof(QDate), arg2);
 }
Esempio n. 46
0
File: Qt.cs Progetto: KDE/qyoto
 public static QDataStream Write(QDataStream arg1, QDate arg2)
 {
     return (QDataStream) staticInterceptor.Invoke("operator<<##", "operator<<(QDataStream&, const QDate&)", typeof(QDataStream), typeof(QDataStream), arg1, typeof(QDate), arg2);
 }
Esempio n. 47
0
 public virtual string YearString(QDate date, KCalendarSystem.StringFormat format)
 {
     return (string) interceptor.Invoke("yearString#$", "yearString(const QDate&, KCalendarSystem::StringFormat) const", typeof(string), typeof(QDate), date, typeof(KCalendarSystem.StringFormat), format);
 }
Esempio n. 48
0
 public virtual string YearString(QDate date)
 {
     return (string) interceptor.Invoke("yearString#", "yearString(const QDate&) const", typeof(string), typeof(QDate), date);
 }
Esempio n. 49
0
 public virtual int WeekNumber(QDate date)
 {
     return (int) interceptor.Invoke("weekNumber#", "weekNumber(const QDate&) const", typeof(int), typeof(QDate), date);
 }
Esempio n. 50
0
 public virtual int Year(QDate date)
 {
     return (int) interceptor.Invoke("year#", "year(const QDate&) const", typeof(int), typeof(QDate), date);
 }
Esempio n. 51
0
        public void TestToStringWithDateFormat()
        {
            const DateFormat f = DateFormat.ISODate;

            string s1;
            using (var q = new QDate(1969, 07, 20))
            {
                s1 = q.ToString(f);
            }

            Assert.AreEqual("1969-07-20", s1);
        }
Esempio n. 52
0
 public virtual int WeekNumber(QDate date, ref int yearNum)
 {
     StackItem[] stack = new StackItem[3];
     #if DEBUG
     stack[1].s_class = (IntPtr) DebugGCHandle.Alloc(date);
     #else
     stack[1].s_class = (IntPtr) GCHandle.Alloc(date);
     #endif
     stack[2].s_int = yearNum;
     interceptor.Invoke("weekNumber#$", "weekNumber(const QDate&, int*) const", stack);
     #if DEBUG
     DebugGCHandle.Free((GCHandle) stack[1].s_class);
     #else
     ((GCHandle) stack[1].s_class).Free();
     #endif
     yearNum = stack[2].s_int;
     return stack[0].s_int;
 }
Esempio n. 53
0
        public void TestWeekNumber()
        {
            int week;
            using (var q = new QDate(2014, 11, 20))
            {
                week = q.WeekNumber();
            }

            Assert.AreEqual(47, week);
        }
Esempio n. 54
0
 public void TestYear()
 {
     using (var q = new QDate(2014, 11, 20))
     {
         Assert.AreEqual(2014, q.Year);
     }
 }
Esempio n. 55
0
 public void TestEmptyConstructor()
 {
     using (var s = new QDate())
     {
         Assert.NotNull(s.__Instance);
     }
 }
Esempio n. 56
0
 public virtual string WeekDayName(QDate date, KCalendarSystem.WeekDayNameFormat format)
 {
     return (string) interceptor.Invoke("weekDayName#$", "weekDayName(const QDate&, KCalendarSystem::WeekDayNameFormat) const", typeof(string), typeof(QDate), date, typeof(KCalendarSystem.WeekDayNameFormat), format);
 }
Esempio n. 57
0
File: Qt.cs Progetto: KDE/qyoto
 public static QDBusArgument Read(QDBusArgument a, QDate date)
 {
     return (QDBusArgument) staticInterceptor.Invoke("operator>>##", "operator>>(const QDBusArgument&, QDate&)", typeof(QDBusArgument), typeof(QDBusArgument), a, typeof(QDate), date);
 }
Esempio n. 58
0
        public void TestGreaterEqualOperator()
        {
            bool res; // true
            using (var q = new QDate(2014, 11, 23))
            {
                using (var q2 = new QDate(2014, 11, 22))
                {
                    res = (q >= q2);
                }
            }

            //Assert.GreaterOrEqual(q, q2);

            Assert.IsTrue(res);
        }
Esempio n. 59
0
File: Qt.cs Progetto: KDE/qyoto
 public static QDBusArgument Write(QDBusArgument a, QDate date)
 {
     return (QDBusArgument) staticInterceptor.Invoke("operator<<##", "operator<<(QDBusArgument&, const QDate&)", typeof(QDBusArgument), typeof(QDBusArgument), a, typeof(QDate), date);
 }
Esempio n. 60
0
        public void TestGreaterOperator()
        {
            bool res; // false
            using (var q = new QDate(2014, 11, 20))
            {
                using (var q2 = new QDate(2014, 11, 22))
                {
                    res = (q > q2);
                }
            }

            //Assert.Greater(q, q2);

            Assert.IsFalse(res);
        }