// </Snippet104>

        // <Snippet105>
        ///--------------------------------------------------------------------
        /// <summary>
        /// Obtains an array of primary table headers.
        /// </summary>
        /// <param name="targetControl">
        /// The target control of interest.
        /// </param>
        /// <param name="roworcolumnMajor">
        /// The RowOrColumnMajor specifier.
        /// </param>
        /// <returns>
        /// An AutomationElement array object.
        /// </returns>
        ///--------------------------------------------------------------------
        private Object GetPrimaryHeaders(
            AutomationElement targetControl, RowOrColumnMajor roworcolumnMajor)
        {
            if (targetControl == null)
            {
                throw new ArgumentException("Target element cannot be null.");
            }

            try
            {
                if (roworcolumnMajor ==
                    RowOrColumnMajor.RowMajor)
                {
                    return(targetControl.GetCurrentPropertyValue(
                               TableItemPattern.RowHeaderItemsProperty));
                }

                if (roworcolumnMajor ==
                    RowOrColumnMajor.ColumnMajor)
                {
                    return(targetControl.GetCurrentPropertyValue(
                               TableItemPattern.ColumnHeaderItemsProperty));
                }
            }
            catch (InvalidOperationException)
            {
                // TableItemPattern not supported.
                // TO DO: error processing.
            }

            return(null);
        }
        private static RowOrColumnMajor UiaGetRowOrColumnMajor(BaseProdControl control)
        {
            RowOrColumnMajor retVal = TablePatternHelper.GetRowOrColumnMajor(control.UIAElement);

            LogController.ReceiveLogMessage(new LogMessage(retVal.ToString()));
            return(retVal);
        }
Beispiel #3
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Test case for RowOrColumnMajor
 /// </summary>
 /// -------------------------------------------------------------------
 void TS_GetRowOrColumnMajor(out RowOrColumnMajor rowOrColumnMajor, CheckType ct)
 {
     if (m_useCurrent)
     {
         rowOrColumnMajor = m_pattern.Current.RowOrColumnMajor;
     }
     else
     {
         rowOrColumnMajor = m_pattern.Cached.RowOrColumnMajor;
     }
     m_TestStep++;
 }
Beispiel #4
0
        public void TablePatternTest()
        {
            RowOrColumnMajor expectedMajor = (Atspi
                                ? RowOrColumnMajor.Indeterminate
                                : RowOrColumnMajor.RowMajor);

            Assert.AreEqual(expectedMajor, tablePattern.Current.RowOrColumnMajor,
                            "RowOrColumnMajor");
            Assert.AreEqual(0, tablePattern.Current.GetRowHeaders().Length, "row headers");
            var colHeaders = tablePattern.Current.GetColumnHeaders();

            VerifyTableColumnHeaders(colHeaders);
        }
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Table_RowOrColumnMajor()
        {
            // Arrange
            RowOrColumnMajor expectedValue = RowOrColumnMajor.ColumnMajor;
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetTablePattern(new PatternsData()
                {
                    TablePattern_RowOrColumnMajor = expectedValue
                }) }) as ISupportsTablePattern;

            // Act

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedValue, element.RowOrColumnMajor);
            Assert.Equal(expectedValue, element.RowOrColumnMajor);
        }
 private static extern string Test_ITableProviderGetRowOrColumnMajor(
     [MarshalAs(UnmanagedType.IUnknown)] object pUnk,
     RowOrColumnMajor expected);
Beispiel #7
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Test case for RowOrColumnMajor
 /// </summary>
 /// -------------------------------------------------------------------
 void TS_GetRowOrColumnMajor(out RowOrColumnMajor rowOrColumnMajor, CheckType ct)
 {
     if (m_useCurrent)
     {
         rowOrColumnMajor = m_pattern.Current.RowOrColumnMajor;
     }
     else
     {
         rowOrColumnMajor = m_pattern.Cached.RowOrColumnMajor;
     }
     m_TestStep++;
 }