1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331
|
# This file is a Tcl script to test platform-indifferent features of menus in Tk.
#
# Copyright © 1995-1997 Sun Microsystems, Inc.
# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
# NOTE
#
# This test file is platform-indifferent. Tests regarding the menu system that
# are specific to the unix platform (this includes macOS), or to the windows
# platform go into the test files unixMenu.test or winMenu.test respectively.
#
#
# TESTFILE INITIALIZATION
#
package require tcltest 2.2; # needed in mode -singleproc 0
# Load the main script main.tcl, which takes care of:
# - setup for the application and the root window
# - importing commands from the tcltest namespace
# - loading of the testutils mechanism along with its utility procs
# - loading of Tk specific test constraints (additionally to constraints
# provided by the package tcltest)
source [file join [tcltest::configure -testdir] main.tcl]
# Ensure a pristine initial window state
resetWindows
# Import utility procs for specific functional areas
testutils import image
imageInit
#
# TESTS
#
test menu-1.1 {Tk_MenuCmd procedure} -body {
menu
} -returnCodes error -result {wrong # args: should be "menu pathName ?-option value ...?"}
test menu-1.2 {Tk_MenuCmd procedure} -body {
menu bogus
} -returnCodes error -result {bad window path name "bogus"}
test menu-1.3 {Tk_MenuCmd procedure} -body {
destroy .m1
menu .m1 foo
} -returnCodes error -result {unknown option "foo"}
test menu-1.4 {Tk_MenuCmd procedure} -body {
destroy .m1
menu .m1
} -cleanup {
deleteWindows
} -result {.m1}
test menu-1.5 {Tk_MenuCmd - creating menubar} -setup {
destroy .m1
} -body {
menu .m1
.m1 add cascade -label Test -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-1.6 {Tk_MenuCmd procedure menu ref no cascade} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
menu .m1
} -cleanup {
deleteWindows
} -result {.m1}
test menu-1.7 {Tk_MenuCmd procedure one clone cascade} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
menu .m1
.m1 add cascade -menu .m2
menu .m2
} -cleanup {
deleteWindows
} -result {.m2}
test menu-1.8 {Tk_MenuCmd procedure two clone cascades} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
menu .m2
} -cleanup {
deleteWindows
} -result {.m2}
test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
menu .m1
.m1 add cascade -menu .m2
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
list [menu .m2]
} -cleanup {
deleteWindows
} -result {.m2}
test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
menu .m1
.m1 add cascade -menu .m2
list [menu .m2]
} -cleanup {
deleteWindows
} -result {.m2}
test menu-1.11 {Tk_MenuCmd procedure three clones cascades} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
toplevel .t4 -menu .m1
wm geometry .t4 +0+0
menu .m1
.m1 add cascade -menu .m2
list [menu .m2]
} -cleanup {
deleteWindows
} -result {.m2}
test menu-1.12 {Tk_MenuCmd procedure} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
list [menu .m1]
} -cleanup {
deleteWindows
} -result {.m1}
test menu-1.13 {Tk_MenuCmd procedure} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
list [menu .m1]
} -cleanup {
deleteWindows
} -result {.m1}
test menu-1.14 {Tk_MenuCmd procedure} -setup {
deleteWindows
} -body {
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
toplevel .t4 -menu .m1
wm geometry .t4 +0+0
list [menu .m1]
} -cleanup {
deleteWindows
} -result {.m1}
#
# COMMON TEST SETUP
#
# For tests 2.1 - 2.30
#
destroy .m1
menu .m1
test menu-2.1 {configuration options -activebackground #012345} -body {
.m1 configure -activebackground #012345
.m1 cget -activebackground
} -result {#012345}
test menu-2.2 {configuration options -activebackground non-existent} -body {
.m1 configure -activebackground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.3 {configuration options -activeborderwidth 1.3} -body {
.m1 configure -activeborderwidth 1.3
.m1 cget -activeborderwidth
} -result {1.3}
test menu-2.4 {configuration options -activeborderwidth badValue} -body {
.m1 configure -activeborderwidth badValue
} -returnCodes error -result {expected screen distance but got "badValue"}
test menu-2.5 {configuration options -activeforeground #ff0000} -body {
.m1 configure -activeforeground #ff0000
.m1 cget -activeforeground
} -result {#ff0000}
test menu-2.6 {configuration options -activeforeground non-existent} -body {
.m1 configure -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.6a {configuration options -activerelief sunken} -body {
.m1 configure -activerelief sunken
.m1 cget -activerelief
} -result {sunken}
test menu-2.6b {configuration options -activerelief badValue} -body {
.m1 configure -activerelief badValue
} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
test menu-2.7 {configuration options -background #ff0000} -body {
.m1 configure -background #ff0000
.m1 cget -background
} -result {#ff0000}
test menu-2.8 {configuration options -background non-existent} -body {
.m1 configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.9 {configuration options -bg #110022} -body {
.m1 configure -bg #110022
.m1 cget -bg
} -result {#110022}
test menu-2.10 {configuration options -bg bogus} -body {
.m1 configure -bg bogus
} -returnCodes error -result {unknown color name "bogus"}
test menu-2.11 {configuration options -borderwidth 1.3} -body {
.m1 configure -borderwidth 1.3
.m1 cget -borderwidth
} -result {1.3}
test menu-2.12 {configuration options -borderwidth badValue} -body {
.m1 configure -borderwidth badValue
} -returnCodes error -result {expected screen distance but got "badValue"}
test menu-2.13 {configuration options -cursor arrow} -body {
.m1 configure -cursor arrow
.m1 cget -cursor
} -result {arrow}
test menu-2.14 {configuration options -cursor badValue} -body {
.m1 configure -cursor badValue
} -returnCodes error -result {bad cursor spec "badValue"}
test menu-2.15 {configuration options -disabledforeground #00ff00} -body {
.m1 configure -disabledforeground #00ff00
.m1 cget -disabledforeground
} -result {#00ff00}
test menu-2.16 {configuration options -disabledforeground xyzzy} -body {
.m1 configure -disabledforeground xyzzy
} -returnCodes error -result {unknown color name "xyzzy"}
test menu-2.17 {configuration options -fg #110022} -body {
.m1 configure -fg #110022
.m1 cget -fg
} -result {#110022}
test menu-2.18 {configuration options -fg bogus} -body {
.m1 configure -fg bogus
} -returnCodes error -result {unknown color name "bogus"}
test menu-2.19 {configuration options -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*} -body {
.m1 configure -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
.m1 cget -font
} -result {-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
test menu-2.20 {configuration options -foreground #110022} -body {
.m1 configure -foreground #110022
.m1 cget -foreground
} -result {#110022}
test menu-2.21 {configuration options -foreground bogus} -body {
.m1 configure -foreground bogus
} -returnCodes error -result {unknown color name "bogus"}
test menu-2.22 {configuration options -postcommand {any old string}} -body {
.m1 configure -postcommand {any old string}
.m1 cget -postcommand
} -result {any old string}
test menu-2.23 {configuration options -relief groove} -body {
.m1 configure -relief groove
.m1 cget -relief
} -result {groove}
test menu-2.24 {configuration options -relief 1.5} -body {
.m1 configure -relief 1.5
} -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}
test menu-2.25 {configuration options -selectcolor #110022} -body {
.m1 configure -selectcolor #110022
.m1 cget -selectcolor
} -result {#110022}
test menu-2.26 {configuration options -selectcolor bogus} -body {
.m1 configure -selectcolor bogus
} -returnCodes error -result {unknown color name "bogus"}
test menu-2.27 {configuration options -takefocus {any string}} -body {
.m1 configure -takefocus {any string}
.m1 cget -takefocus
} -result {any string}
test menu-2.28 {configuration options -tearoff 0} -body {
.m1 configure -tearoff 0
.m1 cget -tearoff
} -result 0
test menu-2.29 {configuration options -tearoff 1} -body {
.m1 configure -tearoff 1
.m1 cget -tearoff
} -result 1
test menu-2.30 {configuration options -tearoffcommand {any old string}} -body {
.m1 configure -tearoffcommand {any old string}
.m1 cget -tearoffcommand
} -result {any old string}
#
# COMMON TEST SETUP
#
# For tests 2.31 - 2.228
#
# We need to test all of the options with all of the different types of
# menu entries. The following code sets up .m1 with 6 items. It then
# runs through the 2.31 - 2.228 tests below
# index 0 is tearoff, 1 command, 2 cascade, 3 separator, 4 checkbutton,
# 5 radiobutton
deleteWindows
menu .m1 -tearoff 1
.m1 add command -label "command"
menu .m2 -tearoff 1
.m2 add command -label "test"
.m1 add cascade -label "cascade" -menu .m2
.m1 add separator
.m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
.m1 add radiobutton -label "radiobutton" -variable radio
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo image1 -file $earthPhotoFile
test menu-2.31 {entry configuration options 0 -activebackground #012345 tearoff} -body {
.m1 entryconfigure 0 -activebackground #012345
} -returnCodes error -result {unknown option "-activebackground"}
test menu-2.32 {entry configuration options 1 -activebackground #012345 command} -body {
.m1 entryconfigure 1 -activebackground #012345
lindex [.m1 entryconfigure 1 -activebackground] 4
} -result {#012345}
test menu-2.33 {entry configuration options 2 -activebackground #012345 cascade} -body {
.m1 entryconfigure 2 -activebackground #012345
lindex [.m1 entryconfigure 2 -activebackground] 4
} -result {#012345}
test menu-2.34 {entry configuration options 3 -activebackground #012345 separator} -body {
.m1 entryconfigure 3 -activebackground #012345
} -returnCodes error -result {unknown option "-activebackground"}
test menu-2.35 {entry configuration options 4 -activebackground #012345 checkbutton} -body {
.m1 entryconfigure 4 -activebackground #012345
lindex [.m1 entryconfigure 4 -activebackground] 4
} -result {#012345}
test menu-2.36 {entry configuration options 5 -activebackground #012345 radiobutton} -body {
.m1 entryconfigure 5 -activebackground #012345
lindex [.m1 entryconfigure 5 -activebackground] 4
} -result {#012345}
test menu-2.37 {entry configuration options 0 -activebackground non-existent tearoff} -body {
.m1 entryconfigure 0 -activebackground non-existent
} -returnCodes error -result {unknown option "-activebackground"}
test menu-2.38 {entry configuration options 1 -activebackground non-existent command} -body {
.m1 entryconfigure 1 -activebackground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.39 {entry configuration options 2 -activebackground non-existent cascade} -body {
.m1 entryconfigure 2 -activebackground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.40 {entry configuration options 3 -activebackground non-existent separator} -body {
.m1 entryconfigure 3 -activebackground non-existent
} -returnCodes error -result {unknown option "-activebackground"}
test menu-2.41 {entry configuration options 4 -activebackground non-existent checkbutton} -body {
.m1 entryconfigure 4 -activebackground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.42 {entry configuration options 5 -activebackground non-existent radiobutton} -body {
.m1 entryconfigure 5 -activebackground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.43 {entry configuration options 0 -activeforeground #ff0000 tearoff} -body {
.m1 entryconfigure 0 -activeforeground #ff0000
} -returnCodes error -result {unknown option "-activeforeground"}
test menu-2.44 {entry configuration options 1 -activeforeground #ff0000 command} -body {
.m1 entryconfigure 1 -activeforeground #ff0000
lindex [.m1 entryconfigure 1 -activeforeground] 4
} -result {#ff0000}
test menu-2.45 {entry configuration options 2 -activeforeground #ff0000 cascade} -body {
.m1 entryconfigure 2 -activeforeground #ff0000
lindex [.m1 entryconfigure 2 -activeforeground] 4
} -result {#ff0000}
test menu-2.46 {entry configuration options 3 -activeforeground #ff0000 separator} -body {
.m1 entryconfigure 3 -activeforeground #ff0000
} -returnCodes error -result {unknown option "-activeforeground"}
test menu-2.47 {entry configuration options 4 -activeforeground #ff0000 checkbutton} -body {
.m1 entryconfigure 4 -activeforeground #ff0000
lindex [.m1 entryconfigure 4 -activeforeground] 4
} -result {#ff0000}
test menu-2.48 {entry configuration options 5 -activeforeground #ff0000 radiobutton} -body {
.m1 entryconfigure 5 -activeforeground #ff0000
lindex [.m1 entryconfigure 5 -activeforeground] 4
} -result {#ff0000}
test menu-2.49 {entry configuration options 0 -activeforeground non-existent tearoff} -body {
.m1 entryconfigure 0 -activeforeground non-existent
} -returnCodes error -result {unknown option "-activeforeground"}
test menu-2.50 {entry configuration options 1 -activeforeground non-existent command} -body {
.m1 entryconfigure 1 -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.51 {entry configuration options 2 -activeforeground non-existent cascade} -body {
.m1 entryconfigure 2 -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.52 {entry configuration options 3 -activeforeground non-existent separator} -body {
.m1 entryconfigure 3 -activeforeground non-existent
} -returnCodes error -result {unknown option "-activeforeground"}
test menu-2.53 {entry configuration options 4 -activeforeground non-existent checkbutton} -body {
.m1 entryconfigure 4 -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.54 {entry configuration options 5 -activeforeground non-existent radiobutton} -body {
.m1 entryconfigure 5 -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.55 {entry configuration options 0 -accelerator Ctrl+S tearoff} -body {
.m1 entryconfigure 0 -accelerator Ctrl+S
} -returnCodes error -result {unknown option "-accelerator"}
test menu-2.56 {entry configuration options 1 -accelerator Ctrl+S command} -body {
.m1 entryconfigure 1 -accelerator Ctrl+S
lindex [.m1 entryconfigure 1 -accelerator] 4
} -result {Ctrl+S}
test menu-2.57 {entry configuration options 2 -accelerator Ctrl+S cascade} -body {
.m1 entryconfigure 2 -accelerator Ctrl+S
lindex [.m1 entryconfigure 2 -accelerator] 4
} -result {Ctrl+S}
test menu-2.58 {entry configuration options 3 -accelerator Ctrl+S separator} -body {
.m1 entryconfigure 3 -accelerator Ctrl+S
} -returnCodes error -result {unknown option "-accelerator"}
test menu-2.59 {entry configuration options 4 -accelerator Ctrl+S checkbutton} -body {
.m1 entryconfigure 4 -accelerator Ctrl+S
lindex [.m1 entryconfigure 4 -accelerator] 4
} -result {Ctrl+S}
test menu-2.60 {entry configuration options 5 -accelerator Ctrl+S radiobutton} -body {
.m1 entryconfigure 5 -accelerator Ctrl+S
lindex [.m1 entryconfigure 5 -accelerator] 4
} -result {Ctrl+S}
test menu-2.61 {entry configuration options 0 -background #ff0000 tearoff} -body {
.m1 entryconfigure 0 -background #ff0000
lindex [.m1 entryconfigure 0 -background] 4
} -result {#ff0000}
test menu-2.62 {entry configuration options 1 -background #ff0000 command} -body {
.m1 entryconfigure 1 -background #ff0000
lindex [.m1 entryconfigure 1 -background] 4
} -result {#ff0000}
test menu-2.63 {entry configuration options 2 -background #ff0000 cascade} -body {
.m1 entryconfigure 2 -background #ff0000
lindex [.m1 entryconfigure 2 -background] 4
} -result {#ff0000}
test menu-2.64 {entry configuration options 3 -background #ff0000 separator} -body {
.m1 entryconfigure 3 -background #ff0000
lindex [.m1 entryconfigure 3 -background] 4
} -result {#ff0000}
test menu-2.65 {entry configuration options 4 -background #ff0000 checkbutton} -body {
.m1 entryconfigure 4 -background #ff0000
lindex [.m1 entryconfigure 4 -background] 4
} -result {#ff0000}
test menu-2.66 {entry configuration options 5 -background #ff0000 radiobutton} -body {
.m1 entryconfigure 5 -background #ff0000
lindex [.m1 entryconfigure 5 -background] 4
} -result {#ff0000}
test menu-2.67 {entry configuration options 0 -background non-existent tearoff} -body {
.m1 entryconfigure 0 -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.68 {entry configuration options 1 -background non-existent command} -body {
.m1 entryconfigure 1 -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.69 {entry configuration options 2 -background non-existent cascade} -body {
.m1 entryconfigure 2 -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.70 {entry configuration options 3 -background non-existent separator} -body {
.m1 entryconfigure 3 -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.71 {entry configuration options 4 -background non-existent checkbutton} -body {
.m1 entryconfigure 4 -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.72 {entry configuration options 5 -background non-existent radiobutton} -body {
.m1 entryconfigure 5 -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.73 {entry configuration options 0 -bitmap questhead tearoff} -body {
.m1 entryconfigure 0 -bitmap questhead
} -returnCodes error -result {unknown option "-bitmap"}
test menu-2.74 {entry configuration options 1 -bitmap questhead command} -body {
.m1 entryconfigure 1 -bitmap questhead
lindex [.m1 entryconfigure 1 -bitmap] 4
} -result {questhead}
test menu-2.75 {entry configuration options 2 -bitmap questhead cascade} -body {
.m1 entryconfigure 2 -bitmap questhead
lindex [.m1 entryconfigure 2 -bitmap] 4
} -result {questhead}
test menu-2.76 {entry configuration options 3 -bitmap questhead separator} -body {
.m1 entryconfigure 3 -bitmap questhead
} -returnCodes error -result {unknown option "-bitmap"}
test menu-2.77 {entry configuration options 4 -bitmap questhead checkbutton} -body {
.m1 entryconfigure 4 -bitmap questhead
lindex [.m1 entryconfigure 4 -bitmap] 4
} -result {questhead}
test menu-2.78 {entry configuration options 5 -bitmap questhead radiobutton} -body {
.m1 entryconfigure 5 -bitmap questhead
lindex [.m1 entryconfigure 5 -bitmap] 4
} -result {questhead}
test menu-2.79 {entry configuration options 0 -bitmap badValue tearoff} -body {
.m1 entryconfigure 0 -bitmap badValue
} -returnCodes error -result {unknown option "-bitmap"}
test menu-2.80 {entry configuration options 1 -bitmap badValue command} -body {
.m1 entryconfigure 1 -bitmap badValue
} -returnCodes error -result {bitmap "badValue" not defined}
test menu-2.81 {entry configuration options 2 -bitmap badValue cascade} -body {
.m1 entryconfigure 2 -bitmap badValue
} -returnCodes error -result {bitmap "badValue" not defined}
test menu-2.82 {entry configuration options 3 -bitmap badValue separator} -body {
.m1 entryconfigure 3 -bitmap badValue
} -returnCodes error -result {unknown option "-bitmap"}
test menu-2.83 {entry configuration options 4 -bitmap badValue checkbutton} -body {
.m1 entryconfigure 4 -bitmap badValue
} -returnCodes error -result {bitmap "badValue" not defined}
test menu-2.84 {entry configuration options 5 -bitmap badValue radiobutton} -body {
.m1 entryconfigure 5 -bitmap badValue
} -returnCodes error -result {bitmap "badValue" not defined}
test menu-2.85 {entry configuration options 0 -columnbreak 1 tearoff} -body {
.m1 entryconfigure 0 -columnbreak 1
} -returnCodes error -result {unknown option "-columnbreak"}
test menu-2.86 {entry configuration options 1 -columnbreak 1 command} -body {
.m1 entryconfigure 1 -columnbreak 1
lindex [.m1 entryconfigure 1 -columnbreak] 4
} -result 1
test menu-2.87 {entry configuration options 2 -columnbreak 1 cascade} -body {
.m1 entryconfigure 2 -columnbreak 1
lindex [.m1 entryconfigure 2 -columnbreak] 4
} -result 1
test menu-2.88 {entry configuration options 3 -columnbreak 1 separator} -body {
.m1 entryconfigure 3 -columnbreak 1
} -returnCodes error -result {unknown option "-columnbreak"}
test menu-2.89 {entry configuration options 4 -columnbreak 1 checkbutton} -body {
.m1 entryconfigure 4 -columnbreak 1
lindex [.m1 entryconfigure 4 -columnbreak] 4
} -result 1
test menu-2.90 {entry configuration options 5 -columnbreak 1 radiobutton} -body {
.m1 entryconfigure 5 -columnbreak 1
lindex [.m1 entryconfigure 5 -columnbreak] 4
} -result 1
test menu-2.91 {entry configuration options 0 -command beep tearoff} -body {
.m1 entryconfigure 0 -command beep
} -returnCodes error -result {unknown option "-command"}
test menu-2.92 {entry configuration options 1 -command beep command} -body {
.m1 entryconfigure 1 -command beep
lindex [.m1 entryconfigure 1 -command] 4
} -result {beep}
test menu-2.93 {entry configuration options 2 -command beep cascade} -body {
.m1 entryconfigure 2 -command beep
lindex [.m1 entryconfigure 2 -command] 4
} -result {beep}
test menu-2.94 {entry configuration options 3 -command beep separator} -body {
.m1 entryconfigure 3 -command beep
} -returnCodes error -result {unknown option "-command"}
test menu-2.95 {entry configuration options 4 -command beep checkbutton} -body {
.m1 entryconfigure 4 -command beep
lindex [.m1 entryconfigure 4 -command] 4
} -result {beep}
test menu-2.96 {entry configuration options 5 -command beep radiobutton} -body {
.m1 entryconfigure 5 -command beep
lindex [.m1 entryconfigure 5 -command] 4
} -result {beep}
test menu-2.97 {entry configuration options 0 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* tearoff} -body {
.m1 entryconfigure 0 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
} -returnCodes error -result {unknown option "-font"}
test menu-2.98 {entry configuration options 1 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* command} -body {
.m1 entryconfigure 1 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
lindex [.m1 entryconfigure 1 -font] 4
} -result {-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
test menu-2.99 {entry configuration options 2 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* cascade} -body {
.m1 entryconfigure 2 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
lindex [.m1 entryconfigure 2 -font] 4
} -result {-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
test menu-2.100 {entry configuration options 3 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* separator} -body {
.m1 entryconfigure 3 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
} -returnCodes error -result {unknown option "-font"}
test menu-2.101 {entry configuration options 4 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* checkbutton} -body {
.m1 entryconfigure 4 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
lindex [.m1 entryconfigure 4 -font] 4
} -result {-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
test menu-2.102 {entry configuration options 5 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* radiobutton} -body {
.m1 entryconfigure 5 -font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
lindex [.m1 entryconfigure 5 -font] 4
} -result {-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
test menu-2.103 {entry configuration options 0 -font {kill rock stars} tearoff} -body {
.m1 entryconfigure 0 -font {kill rock stars}
} -returnCodes error -result {unknown option "-font"}
test menu-2.104 {entry configuration options 1 -font {kill rock stars} command} -body {
.m1 entryconfigure 1 -font {kill rock stars}
} -returnCodes error -result {expected integer but got "rock"}
test menu-2.105 {entry configuration options 2 -font {kill rock stars} cascade} -body {
.m1 entryconfigure 2 -font {kill rock stars}
} -returnCodes error -result {expected integer but got "rock"}
test menu-2.106 {entry configuration options 3 -font {kill rock stars} separator} -body {
.m1 entryconfigure 3 -font {kill rock stars}
} -returnCodes error -result {unknown option "-font"}
test menu-2.107 {entry configuration options 4 -font {kill rock stars} checkbutton} -body {
.m1 entryconfigure 4 -font {kill rock stars}
} -returnCodes error -result {expected integer but got "rock"}
test menu-2.108 {entry configuration options 5 -font {kill rock stars} radiobutton} -body {
.m1 entryconfigure 5 -font {kill rock stars}
} -returnCodes error -result {expected integer but got "rock"}
test menu-2.109 {entry configuration options 0 -foreground #110022 tearoff} -body {
.m1 entryconfigure 0 -foreground #110022
} -returnCodes error -result {unknown option "-foreground"}
test menu-2.110 {entry configuration options 1 -foreground #110022 command} -body {
.m1 entryconfigure 1 -foreground #110022
lindex [.m1 entryconfigure 1 -foreground] 4
} -result {#110022}
test menu-2.111 {entry configuration options 2 -foreground #110022 cascade} -body {
.m1 entryconfigure 2 -foreground #110022
lindex [.m1 entryconfigure 2 -foreground] 4
} -result {#110022}
test menu-2.112 {entry configuration options 3 -foreground #110022 separator} -body {
.m1 entryconfigure 3 -foreground #110022
} -returnCodes error -result {unknown option "-foreground"}
test menu-2.113 {entry configuration options 4 -foreground #110022 checkbutton} -body {
.m1 entryconfigure 4 -foreground #110022
lindex [.m1 entryconfigure 4 -foreground] 4
} -result {#110022}
test menu-2.114 {entry configuration options 5 -foreground #110022 radiobutton} -body {
.m1 entryconfigure 5 -foreground #110022
lindex [.m1 entryconfigure 5 -foreground] 4
} -result {#110022}
test menu-2.115 {entry configuration options 0 -foreground non-existent tearoff} -body {
.m1 entryconfigure 0 -foreground non-existent
} -returnCodes error -result {unknown option "-foreground"}
test menu-2.116 {entry configuration options 1 -foreground non-existent command} -body {
.m1 entryconfigure 1 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.117 {entry configuration options 2 -foreground non-existent cascade} -body {
.m1 entryconfigure 2 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.118 {entry configuration options 3 -foreground non-existent separator} -body {
.m1 entryconfigure 3 -foreground non-existent
} -returnCodes error -result {unknown option "-foreground"}
test menu-2.119 {entry configuration options 4 -foreground non-existent checkbutton} -body {
.m1 entryconfigure 4 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.120 {entry configuration options 5 -foreground non-existent radiobutton} -body {
.m1 entryconfigure 5 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.121 {entry configuration options 0 -image image1 tearoff} -body {
.m1 entryconfigure 0 -image image1
} -returnCodes error -result {unknown option "-image"}
test menu-2.122 {entry configuration options 1 -image image1 command} -setup {
.m1 entryconfigure 1 -image {}
} -body {
.m1 entryconfigure 1 -image image1
lindex [.m1 entryconfigure 1 -image] 4
} -cleanup {
.m1 entryconfigure 1 -image {}
} -result {image1}
test menu-2.123 {entry configuration options 2 -image image1 cascade} -setup {
.m1 entryconfigure 2 -image {}
} -body {
.m1 entryconfigure 2 -image image1
lindex [.m1 entryconfigure 2 -image] 4
} -cleanup {
.m1 entryconfigure 2 -image {}
} -result {image1}
test menu-2.124 {entry configuration options 3 -image image1 separator} -body {
.m1 entryconfigure 3 -image image1
} -returnCodes error -result {unknown option "-image"}
test menu-2.125 {entry configuration options 4 -image image1 checkbutton} -setup {
.m1 entryconfigure 4 -image {}
} -body {
.m1 entryconfigure 4 -image image1
lindex [.m1 entryconfigure 4 -image] 4
} -cleanup {
.m1 entryconfigure 4 -image {}
} -result {image1}
test menu-2.126 {entry configuration options 5 -image image1 radiobutton} -setup {
.m1 entryconfigure 5 -image {}
} -body {
.m1 entryconfigure 5 -image image1
lindex [.m1 entryconfigure 5 -image] 4
} -cleanup {
.m1 entryconfigure 5 -image {}
} -result {image1}
test menu-2.127 {entry configuration options 0 -image bogus tearoff} -body {
.m1 entryconfigure 0 -image bogus
} -returnCodes error -result {unknown option "-image"}
test menu-2.128 {entry configuration options 1 -image bogus command} -body {
.m1 entryconfigure 1 -image bogus
} -returnCodes error -result {image "bogus" does not exist}
test menu-2.129 {entry configuration options 2 -image bogus cascade} -body {
.m1 entryconfigure 2 -image bogus
} -returnCodes error -result {image "bogus" does not exist}
test menu-2.130 {entry configuration options 3 -image bogus separator} -body {
.m1 entryconfigure 3 -image bogus
} -returnCodes error -result {unknown option "-image"}
test menu-2.131 {entry configuration options 4 -image bogus checkbutton} -body {
.m1 entryconfigure 4 -image bogus
} -returnCodes error -result {image "bogus" does not exist}
test menu-2.132 {entry configuration options 5 -image bogus radiobutton} -body {
.m1 entryconfigure 5 -image bogus
} -returnCodes error -result {image "bogus" does not exist}
test menu-2.133 {entry configuration options 0 -image {} tearoff} -body {
.m1 entryconfigure 0 -image
} -returnCodes error -result {unknown option "-image"}
test menu-2.134 {entry configuration options 1 -image {} command} -setup {
.m1 entryconfigure 1 -image {}
} -body {
.m1 entryconfigure 1 -image
lindex [.m1 entryconfigure 1 -image] 4
} -result {}
test menu-2.135 {entry configuration options 2 -image {} cascade} -setup {
.m1 entryconfigure 2 -image {}
} -body {
.m1 entryconfigure 2 -image
lindex [.m1 entryconfigure 2 -image] 4
} -result {}
test menu-2.136 {entry configuration options 3 -image {} separator} -body {
.m1 entryconfigure 3 -image
} -returnCodes error -result {unknown option "-image"}
test menu-2.137 {entry configuration options 4 -image {} checkbutton} -body {
.m1 entryconfigure 4 -image
lindex [.m1 entryconfigure 4 -image] 4
} -result {}
test menu-2.138 {entry configuration options 5 -image {} radiobutton} -body {
.m1 entryconfigure 5 -image
lindex [.m1 entryconfigure 5 -image] 4
} -result {}
test menu-2.139 {entry configuration options 0 -indicatoron 1 tearoff} -body {
.m1 entryconfigure 0 -indicatoron 1
} -returnCodes error -result {unknown option "-indicatoron"}
test menu-2.140 {entry configuration options 1 -indicatoron 1 command} -body {
.m1 entryconfigure 1 -indicatoron 1
} -returnCodes error -result {unknown option "-indicatoron"}
test menu-2.141 {entry configuration options 2 -indicatoron 1 cascade} -body {
.m1 entryconfigure 2 -indicatoron 1
} -returnCodes error -result {unknown option "-indicatoron"}
test menu-2.142 {entry configuration options 3 -indicatoron 1 separator} -body {
.m1 entryconfigure 3 -indicatoron 1
} -returnCodes error -result {unknown option "-indicatoron"}
test menu-2.143 {entry configuration options 4 -indicatoron 1 checkbutton} -body {
.m1 entryconfigure 4 -indicatoron 1
lindex [.m1 entryconfigure 4 -indicatoron] 4
} -result 1
test menu-2.144 {entry configuration options 5 -indicatoron 1 radiobutton} -body {
.m1 entryconfigure 5 -indicatoron 1
lindex [.m1 entryconfigure 5 -indicatoron] 4
} -result 1
test menu-2.145 {entry configuration options 0 -label test tearoff} -body {
.m1 entryconfigure 0 -label test
} -returnCodes error -result {unknown option "-label"}
test menu-2.146 {entry configuration options 1 -label test command} -body {
.m1 entryconfigure 1 -label test
lindex [.m1 entryconfigure 1 -label] 4
} -result {test}
test menu-2.147 {entry configuration options 2 -label test cascade} -body {
.m1 entryconfigure 2 -label test
lindex [.m1 entryconfigure 2 -label] 4
} -result {test}
test menu-2.148 {entry configuration options 3 -label test separator} -body {
.m1 entryconfigure 3 -label test
} -returnCodes error -result {unknown option "-label"}
test menu-2.149 {entry configuration options 4 -label test checkbutton} -body {
.m1 entryconfigure 4 -label test
lindex [.m1 entryconfigure 4 -label] 4
} -result {test}
test menu-2.150 {entry configuration options 5 -label test radiobutton} -body {
.m1 entryconfigure 5 -label test
lindex [.m1 entryconfigure 5 -label] 4
} -result {test}
test menu-2.151 {entry configuration options 0 -menu .m2 tearoff} -body {
.m1 entryconfigure 0 -menu .m2
} -returnCodes error -result {unknown option "-menu"}
test menu-2.152 {entry configuration options 1 -menu .m2 command} -body {
.m1 entryconfigure 1 -menu .m2
} -returnCodes error -result {unknown option "-menu"}
test menu-2.153 {entry configuration options 2 -menu .m2 cascade} -body {
.m1 entryconfigure 2 -menu .m2
lindex [.m1 entryconfigure 2 -menu] 4
} -result {.m2}
test menu-2.154 {entry configuration options 3 -menu .m2 separator} -body {
.m1 entryconfigure 3 -menu .m2
} -returnCodes error -result {unknown option "-menu"}
test menu-2.155 {entry configuration options 4 -menu .m2 checkbutton} -body {
.m1 entryconfigure 4 -menu .m2
} -returnCodes error -result {unknown option "-menu"}
test menu-2.156 {entry configuration options 5 -menu .m2 radiobutton} -body {
.m1 entryconfigure 5 -menu .m2
} -returnCodes error -result {unknown option "-menu"}
test menu-2.157 {entry configuration options 0 -offvalue off tearoff} -body {
.m1 entryconfigure 0 -offvalue off
} -returnCodes error -result {unknown option "-offvalue"}
test menu-2.158 {entry configuration options 1 -offvalue off command} -body {
.m1 entryconfigure 1 -offvalue off
} -returnCodes error -result {unknown option "-offvalue"}
test menu-2.159 {entry configuration options 2 -offvalue off cascade} -body {
.m1 entryconfigure 2 -offvalue off
} -returnCodes error -result {unknown option "-offvalue"}
test menu-2.160 {entry configuration options 3 -offvalue off separator} -body {
.m1 entryconfigure 3 -offvalue off
} -returnCodes error -result {unknown option "-offvalue"}
test menu-2.161 {entry configuration options 4 -offvalue off checkbutton} -body {
.m1 entryconfigure 4 -offvalue off
lindex [.m1 entryconfigure 4 -offvalue] 4
} -result {off}
test menu-2.162 {entry configuration options 5 -offvalue off radiobutton} -body {
.m1 entryconfigure 5 -offvalue off
} -returnCodes error -result {unknown option "-offvalue"}
test menu-2.163 {entry configuration options 0 -onvalue on tearoff} -body {
.m1 entryconfigure 0 -onvalue on
} -returnCodes error -result {unknown option "-onvalue"}
test menu-2.164 {entry configuration options 1 -onvalue on command} -body {
.m1 entryconfigure 1 -onvalue on
} -returnCodes error -result {unknown option "-onvalue"}
test menu-2.165 {entry configuration options 2 -onvalue on cascade} -body {
.m1 entryconfigure 2 -onvalue on
} -returnCodes error -result {unknown option "-onvalue"}
test menu-2.166 {entry configuration options 3 -onvalue on separator} -body {
.m1 entryconfigure 3 -onvalue on
} -returnCodes error -result {unknown option "-onvalue"}
test menu-2.167 {entry configuration options 4 -onvalue on checkbutton} -body {
.m1 entryconfigure 4 -onvalue on
lindex [.m1 entryconfigure 4 -onvalue] 4
} -result {on}
test menu-2.168 {entry configuration options 5 -onvalue on radiobutton} -body {
.m1 entryconfigure 5 -onvalue on
} -returnCodes error -result {unknown option "-onvalue"}
test menu-2.169 {entry configuration options 0 -selectcolor #110022 tearoff} -body {
.m1 entryconfigure 0 -selectcolor #110022
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.170 {entry configuration options 1 -selectcolor #110022 command} -body {
.m1 entryconfigure 1 -selectcolor #110022
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.171 {entry configuration options 2 -selectcolor #110022 cascade} -body {
.m1 entryconfigure 2 -selectcolor #110022
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.172 {entry configuration options 3 -selectcolor #110022 separator} -body {
.m1 entryconfigure 3 -selectcolor #110022
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.173 {entry configuration options 4 -selectcolor #110022 checkbutton} -body {
.m1 entryconfigure 4 -selectcolor #110022
lindex [.m1 entryconfigure 4 -selectcolor] 4
} -result {#110022}
test menu-2.174 {entry configuration options 5 -selectcolor #110022 radiobutton} -body {
.m1 entryconfigure 5 -selectcolor #110022
lindex [.m1 entryconfigure 5 -selectcolor] 4
} -result {#110022}
test menu-2.175 {entry configuration options 0 -selectcolor non-existent tearoff} -body {
.m1 entryconfigure 0 -selectcolor non-existent
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.176 {entry configuration options 1 -selectcolor non-existent command} -body {
.m1 entryconfigure 1 -selectcolor non-existent
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.177 {entry configuration options 2 -selectcolor non-existent cascade} -body {
.m1 entryconfigure 2 -selectcolor non-existent
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.178 {entry configuration options 3 -selectcolor non-existent separator} -body {
.m1 entryconfigure 3 -selectcolor non-existent
} -returnCodes error -result {unknown option "-selectcolor"}
test menu-2.179 {entry configuration options 4 -selectcolor non-existent checkbutton} -body {
.m1 entryconfigure 4 -selectcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.180 {entry configuration options 5 -selectcolor non-existent radiobutton} -body {
.m1 entryconfigure 5 -selectcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.181 {entry configuration options 0 -selectimage image1 tearoff} -body {
.m1 entryconfigure 0 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.182 {entry configuration options 1 -selectimage image1 command} -body {
.m1 entryconfigure 1 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.183 {entry configuration options 2 -selectimage image1 cascade} -body {
.m1 entryconfigure 2 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.184 {entry configuration options 3 -selectimage image1 separator} -body {
.m1 entryconfigure 3 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.185 {entry configuration options 4 -selectimage image1 checkbutton} -setup {
.m1 entryconfigure 4 -selectimage {}
} -body {
.m1 entryconfigure 4 -selectimage image1
lindex [.m1 entryconfigure 4 -selectimage] 4
} -cleanup {
.m1 entryconfigure 4 -selectimage {}
} -result {image1}
test menu-2.186 {entry configuration options 5 -selectimage image1 radiobutton} -setup {
.m1 entryconfigure 5 -selectimage {}
} -body {
.m1 entryconfigure 5 -selectimage image1
lindex [.m1 entryconfigure 5 -selectimage] 4
} -cleanup {
.m1 entryconfigure 5 -selectimage {}
} -result {image1}
test menu-2.187 {entry configuration options 0 -selectimage bogus tearoff} -body {
.m1 entryconfigure 0 -selectimage bogus
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.188 {entry configuration options 1 -selectimage bogus command} -body {
.m1 entryconfigure 1 -selectimage bogus
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.189 {entry configuration options 2 -selectimage bogus cascade} -body {
.m1 entryconfigure 2 -selectimage bogus
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.190 {entry configuration options 3 -selectimage bogus separator} -body {
.m1 entryconfigure 3 -selectimage bogus
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.191 {entry configuration options 4 -selectimage bogus checkbutton} -body {
.m1 entryconfigure 4 -selectimage bogus
} -returnCodes error -result {image "bogus" does not exist}
test menu-2.192 {entry configuration options 5 -selectimage bogus radiobutton} -body {
.m1 entryconfigure 5 -selectimage bogus
} -returnCodes error -result {image "bogus" does not exist}
test menu-2.193 {entry configuration options 0 -selectimage {} tearoff} -body {
.m1 entryconfigure 0 -selectimage
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.194 {entry configuration options 1 -selectimage {} command} -body {
.m1 entryconfigure 1 -selectimage
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.195 {entry configuration options 2 -selectimage {} cascade} -body {
.m1 entryconfigure 2 -selectimage
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.196 {entry configuration options 3 -selectimage {} separator} -body {
.m1 entryconfigure 3 -selectimage
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.197 {entry configuration options 4 -selectimage {} checkbutton} -body {
.m1 entryconfigure 4 -selectimage
lindex [.m1 entryconfigure 4 -selectimage] 4
} -result {}
test menu-2.198 {entry configuration options 5 -selectimage {} radiobutton} -body {
.m1 entryconfigure 5 -selectimage
lindex [.m1 entryconfigure 5 -selectimage] 4
} -result {}
test menu-2.199 {entry configuration options 0 -state normal tearoff} -body {
.m1 entryconfigure 0 -state normal
lindex [.m1 entryconfigure 0 -state] 4
} -result {normal}
test menu-2.200 {entry configuration options 1 -state normal command} -body {
.m1 entryconfigure 1 -state normal
lindex [.m1 entryconfigure 1 -state] 4
} -result {normal}
test menu-2.201 {entry configuration options 2 -state normal cascade} -body {
.m1 entryconfigure 2 -state normal
lindex [.m1 entryconfigure 2 -state] 4
} -result {normal}
test menu-2.202 {entry configuration options 3 -state normal separator} -body {
.m1 entryconfigure 3 -state normal
} -returnCodes error -result {unknown option "-state"}
test menu-2.203 {entry configuration options 4 -state normal checkbutton} -body {
.m1 entryconfigure 4 -state normal
lindex [.m1 entryconfigure 4 -state] 4
} -result {normal}
test menu-2.204 {entry configuration options 5 -state normal radiobutton} -body {
.m1 entryconfigure 5 -state normal
lindex [.m1 entryconfigure 5 -state] 4
} -result {normal}
test menu-2.205 {entry configuration options 0 -value {any string} tearoff} -body {
.m1 entryconfigure 0 -value {any string}
} -returnCodes error -result {unknown option "-value"}
test menu-2.206 {entry configuration options 1 -value {any string} command} -body {
.m1 entryconfigure 1 -value {any string}
} -returnCodes error -result {unknown option "-value"}
test menu-2.207 {entry configuration options 2 -value {any string} cascade} -body {
.m1 entryconfigure 2 -value {any string}
} -returnCodes error -result {unknown option "-value"}
test menu-2.208 {entry configuration options 3 -value {any string} separator} -body {
.m1 entryconfigure 3 -value {any string}
} -returnCodes error -result {unknown option "-value"}
test menu-2.209 {entry configuration options 4 -value {any string} checkbutton} -body {
.m1 entryconfigure 4 -value {any string}
} -returnCodes error -result {unknown option "-value"}
test menu-2.210 {entry configuration options 5 -value {any string} radiobutton} -body {
.m1 entryconfigure 5 -value {any string}
lindex [.m1 entryconfigure 5 -value] 4
} -result {any string}
test menu-2.211 {entry configuration options 0 -variable {any string} tearoff} -body {
.m1 entryconfigure 0 -variable {any string}
} -returnCodes error -result {unknown option "-variable"}
test menu-2.212 {entry configuration options 1 -variable {any string} command} -body {
.m1 entryconfigure 1 -variable {any string}
} -returnCodes error -result {unknown option "-variable"}
test menu-2.213 {entry configuration options 2 -variable {any string} cascade} -body {
.m1 entryconfigure 2 -variable {any string}
} -returnCodes error -result {unknown option "-variable"}
test menu-2.214 {entry configuration options 3 -variable {any string} separator} -body {
.m1 entryconfigure 3 -variable {any string}
} -returnCodes error -result {unknown option "-variable"}
test menu-2.215 {entry configuration options 4 -variable {any string} checkbutton} -body {
.m1 entryconfigure 4 -variable {any string}
lindex [.m1 entryconfigure 4 -variable] 4
} -result {any string}
test menu-2.216 {entry configuration options 5 -variable {any string} radiobutton} -body {
.m1 entryconfigure 5 -variable {any string}
lindex [.m1 entryconfigure 5 -variable] 4
} -result {any string}
test menu-2.217 {entry configuration options 0 -underline 0 tearoff} -body {
.m1 entryconfigure 0 -underline 0
} -returnCodes error -result {unknown option "-underline"}
test menu-2.218 {entry configuration options 1 -underline 0 command} -body {
.m1 entryconfigure 1 -underline 0
lindex [.m1 entryconfigure 1 -underline] 4
} -result 0
test menu-2.219 {entry configuration options 2 -underline 0 cascade} -body {
.m1 entryconfigure 2 -underline 0
lindex [.m1 entryconfigure 2 -underline] 4
} -result 0
test menu-2.220 {entry configuration options 3 -underline 0 separator} -body {
.m1 entryconfigure 3 -underline 0
} -returnCodes error -result {unknown option "-underline"}
test menu-2.221 {entry configuration options 4 -underline 0 checkbutton} -body {
.m1 entryconfigure 4 -underline 0
lindex [.m1 entryconfigure 4 -underline] 4
} -result 0
test menu-2.222 {entry configuration options 5 -underline 0 radiobutton} -body {
.m1 entryconfigure 5 -underline 0
lindex [.m1 entryconfigure 5 -underline] 4
} -result 0
test menu-2.223 {entry configuration options 0 -underline 3p tearoff} -body {
.m1 entryconfigure 0 -underline 3p
} -returnCodes error -result {unknown option "-underline"}
test menu-2.224 {entry configuration options 1 -underline 3p command} -body {
.m1 entryconfigure 1 -underline 3p
} -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""}
test menu-2.225 {entry configuration options 2 -underline 3p cascade} -body {
.m1 entryconfigure 2 -underline 3p
} -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""}
test menu-2.226 {entry configuration options 3 -underline 3p separator} -body {
.m1 entryconfigure 3 -underline 3p
} -returnCodes error -result {unknown option "-underline"}
test menu-2.227 {entry configuration options 4 -underline 3p checkbutton} -body {
.m1 entryconfigure 4 -underline 3p
} -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""}
test menu-2.228 {entry configuration options 5 -underline 3p radiobutton} -body {
.m1 entryconfigure 5 -underline 3p
} -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer?, or ""}
#
# COMMON TEST CLEANUP
#
deleteWindows
image delete image1
test menu-3.1 {MenuWidgetCmd procedure} -setup {
destroy .m1
} -body {
menu .m1
.m1
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 option ?arg ...?"}
test menu-3.2 {MenuWidgetCmd, Tcl_Preserve and Tcl_Release} -constraints {
nonUnixUserInteraction
} -setup {
destroy .m1
} -body {
menu .m1 -postcommand "destroy .m1"
.m1 add command -label "menu-3.2: Hit Escape"
.m1 post 40 40
} -cleanup {
destroy .m1
} -returnCodes ok -result {}
test menu-3.3 {MenuWidgetCmd procedure, "activate" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 activate
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 activate index"}
test menu-3.4 {MenuWidgetCmd procedure, "activate" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 activate "foo"
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.5 {MenuWidgetCmd procedure, "activate" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 add separator
.m1 activate 2
} -cleanup {
destroy .m1
} -result {}
test menu-3.6 {MenuWidgetCmd procedure, "activate" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 entryconfigure 1 -state disabled
.m1 activate 1
} -cleanup {
destroy .m1
} -result {}
test menu-3.7 {MenuWidgetCmd procedure, "activate" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 activate 1
} -cleanup {
destroy .m1
} -result {}
test menu-3.8 {MenuWidgetCmd procedure, "add" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 add type ?-option value ...?"}
test menu-3.9 {MenuWidgetCmd procedure, "add" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add foo
} -cleanup {
destroy .m1
} -returnCodes error -result {bad menu entry type "foo": must be cascade, checkbutton, command, radiobutton, or separator}
test menu-3.10 {MenuWidgetCmd procedure, "add" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add separator
} -cleanup {
destroy .m1
} -result {e001}
test menu-3.11 {MenuWidgetCmd procedure, "cget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 cget
} -returnCodes error -result {wrong # args: should be ".m1 cget option"}
test menu-3.12 {MenuWidgetCmd procedure, "cget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 cget -gorp
} -returnCodes error -result {unknown option "-gorp"}
test menu-3.13 {MenuWidgetCmd procedure, "cget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 configure -postcommand "Some string"
.m1 cget -postcommand
} -cleanup {
destroy .m1
} -result {Some string}
test menu-3.14 {MenuWidgetCmd procedure, "clone" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 clone
} -returnCodes error -result {wrong # args: should be ".m1 clone newMenuName ?menuType?"}
test menu-3.15 {MenuWidgetCmd procedure, "clone" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 clone a b c d
} -returnCodes error -result {wrong # args: should be ".m1 clone newMenuName ?menuType?"}
test menu-3.16 {MenuWidgetCmd procedure, "clone" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 clone .m1.clone1
} -cleanup {
destroy .m1
} -result {}
test menu-3.17 {MenuWidgetCmd procedure, "clone" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 clone .m1.clone1 tearoff
} -cleanup {
destroy .m1
} -result {}
test menu-3.18 {MenuWidgetCmd procedure, "configure" option} -setup {
destroy .m1
} -body {
menu .m1
llength [.m1 configure]
} -cleanup {
destroy .m1
} -result 21
test menu-3.19 {MenuWidgetCmd procedure, "configure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
test menu-3.20 {MenuWidgetCmd procedure, "configure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 configure -postcommand "A random String"
} -cleanup {
destroy .m1
} -result {}
test menu-3.21 {MenuWidgetCmd procedure, "configure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 configure -postcommand "Another string"
lindex [.m1 configure -postcommand] 4
} -cleanup {
destroy .m1
} -result {Another string}
test menu-3.22 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 delete
} -returnCodes error -result {wrong # args: should be ".m1 delete first ?last?"}
test menu-3.23 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 delete foo
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.24 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1 -tearoff 1
.m1 delete 0 "foo"
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.25 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 delete 0
} -cleanup {
destroy .m1
} -result {}
test menu-3.26 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "foo"
.m1 delete 1 0
} -cleanup {
destroy .m1
} -result {}
test menu-3.27 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "1"
.m1 add command -label "2"
.m1 add command -label "3"
.m1 delete 1 3
} -cleanup {
destroy .m1
} -result {}
test menu-3.28 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "1"
.m1 add command -label "2"
.m1 add command -label "3"
.m1 activate 2
.m1 delete 1 3
} -cleanup {
destroy .m1
} -result {}
test menu-3.29 {MenuWidgetCmd procedure, "delete" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "1"
.m1 add command -label "2"
.m1 add command -label "3"
.m1 activate 3
.m1 delete 1
} -cleanup {
destroy .m1
} -result {}
test menu-3.29+1 {MenuWidgetCmd, "delete", Bug 220950} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "bogus"
.m1 add command -label "ok"
.m1 delete 10 20
.m1 entrycget last -label
} -cleanup {
destroy .m1
} -result ok
test menu-3.30 {MenuWidgetCmd procedure, "entrycget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 entrycget
} -returnCodes error -result {wrong # args: should be ".m1 entrycget index option"}
test menu-3.31 {MenuWidgetCmd procedure, "entrycget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 entrycget index option foo
} -returnCodes error -result {wrong # args: should be ".m1 entrycget index option"}
test menu-3.32 {MenuWidgetCmd procedure, "entrycget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 entrycget foo -label
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.33 {MenuWidgetCmd procedure, "entrycget" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 entrycget 1 -label
} -cleanup {
destroy .m1
} -result {test}
test menu-3.34 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 entryconfigure
} -returnCodes error -result {wrong # args: should be ".m1 entryconfigure index ?-option value ...?"}
test menu-3.35 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 entryconfigure foo
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.36 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
llength [.m1 entryconfigure 1]
} -cleanup {
destroy .m1
} -result 15
test menu-3.37 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
lindex [.m1 entryconfigure 1 -label] 4
} -cleanup {
destroy .m1
} -result {test}
test menu-3.38 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 entryconfigure 1 -label "changed"
lindex [.m1 entryconfigure 1 -label] 4
} -cleanup {
destroy .m1
} -result {changed}
test menu-3.39 {MenuWidgetCmd procedure, "index" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 index
} -returnCodes error -result {wrong # args: should be ".m1 index string"}
test menu-3.40 {MenuWidgetCmd procedure, "index" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 index foo
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.41 {MenuWidgetCmd procedure, "index" option} -setup {
destroy .m1
} -body {
menu .m1 -tearoff 1
.m1 add command -label "test"
.m1 add command -label "3"
.m1 add command -label "another label"
.m1 add command -label "end"
.m1 add command -label "3a"
.m1 add command -label "final entry"
list [.m1 index "test"] [.m1 index "3"] [.m1 index "3a"] [.m1 index "end"]
} -cleanup {
destroy .m1
} -result {1 3 5 6}
test menu-3.42 {MenuWidgetCmd procedure, "insert" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 insert
} -returnCodes error -result {wrong # args: should be ".m1 insert index type ?-option value ...?"}
test menu-3.43 {MenuWidgetCmd procedure, "insert" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 insert 1 command -label "test"
.m1 entrycget 1 -label
} -cleanup {
destroy .m1
} -result {test}
test menu-3.44 {MenuWidgetCmd procedure, "invoke" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 invoke
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 invoke index"}
test menu-3.45 {MenuWidgetCmd procedure, "invoke" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 invoke foo
} -cleanup {
destroy .m1
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.46 {MenuWidgetCmd procedure, "invoke" option} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add command -label "set foo" -command "set foo hello"
list [.m1 invoke 1] [set foo] [unset foo]
} -cleanup {
destroy .m1
} -returnCodes ok -result {hello hello {}}
test menu-3.47 {MenuWidgetCmd procedure, "post" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "On Windows, hit Escape to get this menu to go away"
.m1 post
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 post x y ?index?"}
test menu-3.48 {MenuWidgetCmd procedure, "post" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 post foo 40
} -cleanup {
destroy .m1
} -returnCodes error -result {expected integer but got "foo"}
test menu-3.49 {MenuWidgetCmd procedure, "post" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 post 40 bar
} -cleanup {
destroy .m1
} -returnCodes error -result {expected integer but got "bar"}
test menu-3.50 {MenuWidgetCmd procedure, "post" option} -constraints {
nonUnixUserInteraction
} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "menu-3.50: hit Escape" -command "puts hello"
.m1 post 40 40
} -cleanup {
destroy .m1
} -result {}
test menu-3.51 {MenuWidgetCmd procedure, "postcascade" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 postcascade
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 postcascade index"}
test menu-3.52 {MenuWidgetCmd procedure, "postcascade" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 postcascade foo
} -cleanup {
destroy .m1
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.53 {MenuWidgetCmd procedure, "postcascade" option} -constraints {
nonUnixUserInteraction
} -setup {
destroy .m1 .m2
} -body {
menu .m1
.m1 add command -label "menu-3.53 - hit Escape"
menu .m2
.m1 post 40 40
.m1 add cascade -menu .m2
.m1 postcascade 1
} -cleanup {
destroy .m1 .m2
} -result {}
test menu-3.54 {MenuWidgetCmd procedure, "postcascade" option} -setup {
destroy .m1 .m2
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2 -label "menu-3.57 - hit Escape"
.m1 postcascade 1
.m1 postcascade {}
} -cleanup {
destroy .m1 .m2
} -result {}
test menu-3.55 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 type
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 type index"}
test menu-3.56 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 type foo
} -cleanup {
destroy .m1
} -returnCodes error -result {bad menu entry index "foo"}
test menu-3.57 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 type 1
} -cleanup {
destroy .m1
} -result {command}
test menu-3.58 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add separator
.m1 type 1
} -cleanup {
destroy .m1
} -result {separator}
test menu-3.59 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add checkbutton -label "test"
.m1 type 1
} -cleanup {
destroy .m1
} -result {checkbutton}
test menu-3.60 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add radiobutton -label "test"
.m1 type 1
} -cleanup {
destroy .m1
} -result {radiobutton}
test menu-3.61 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 add cascade -label "test"
.m1 type 1
} -cleanup {
destroy .m1
} -result {cascade}
test menu-3.62 {MenuWidgetCmd procedure, "type" option} -setup {
destroy .m1
} -body {
menu .m1 -tearoff 1
.m1 type 0
} -cleanup {
destroy .m1
} -result {tearoff}
test menu-3.63 {MenuWidgetCmd procedure, "unpost" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 unpost foo
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 unpost"}
test menu-3.64 {MenuWidgetCmd procedure, "unpost" option} -constraints {
nonUnixUserInteraction
} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "menu-3.64 - hit Escape"
.m1 post 40 40
.m1 unpost
} -cleanup {
destroy .m1
} -result {}
test menu-3.65 {MenuWidgetCmd procedure, "yposition" option} -setup {
destroy .m1
} -body {
menu .m1
.m1 yposition
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 yposition index"}
test menu-3.66a {MenuWidgetCmd procedure, "yposition" option, no tearoff} -setup {
destroy .m1
} -body {
menu .m1 -tearoff 0
.m1 yposition 1
} -cleanup {
destroy .m1
} -result 0
test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints {
notAqua
} -setup {
destroy .m1
} -body {
# on Win or Linux, tearoff menus are supported
# see menu-3.66c for aqua
menu .m1 -tearoff 1
.m1 yposition 1
} -cleanup {
destroy .m1
} -result 1
test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints {
aqua
} -setup {
destroy .m1
} -body {
# on OS X, tearoff menus are not supported
# see menu-3.66b for win or linux
menu .m1 -tearoff 1
.m1 yposition 1
} -cleanup {
destroy .m1
} -result 0
test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup {
destroy .m1
} -body {
menu .m1
.m1 foo
} -cleanup {
destroy .m1
} -returnCodes error -result {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, id, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition}
test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup {
deleteWindows
} -body {
set t .t
set m1 .t.m1
set c1 .t.c1
set c2 .t.c2
toplevel .t
menu $m1 -tearoff 1
menu $c1 -tearoff 1
$c1 add command -label c1
menu $c2 -tearoff 1
$c2 add command -label c2
$m1 add cascade -label c1 -menu $c1
$t configure -menu $m1
$m1 entryconfigure 1 -menu $c2 -label c2
$t configure -menu ""
list [winfo exists $c1] [winfo exists $c2]
} -cleanup {
deleteWindows
} -result {1 1}
test menu-3.69 {MenuWidgetCmd procedure, "xposition" option} -setup {
destroy .m1
menu .m1
} -body {
.m1 xposition
} -cleanup {
destroy .m1
} -returnCodes error -result {wrong # args: should be ".m1 xposition index"}
test menu-3.70 {MenuWidgetCmd procedure, "xposition" option} -setup {
destroy .m1
menu .m1
} -body {
.m1 xposition 1
subst {} ;# just checking that the xposition does not produce an error...
} -cleanup {
destroy .m1
} -result {}
test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup {
destroy .m1
} -body {
menu .m1
.m1 index "end"
} -cleanup {
destroy .m1
} -result {}
test menu-4.1 {TkInvokeMenu: disabled} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off \
-state disabled
list [catch {.m1 invoke 1} msg] $foo
} -cleanup {
destroy .m1
} -result {0 off}
test menu-4.2 {TkInvokeMenu: tearoff} -setup {
destroy .m1
} -body {
menu .m1
catch {.m1 invoke 0}
} -cleanup {
deleteWindows
} -result 0
test menu-4.3 {TkInvokeMenu: checkbutton -on} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off
list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 \
[catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 on 0 {}}
test menu-4.4 {TkInvokeMenu: checkbutton -off} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off
.m1 invoke 1
list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 off 0 {}}
test menu-4.5 {TkInvokeMenu: checkbutton array element} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add checkbutton -label "test" -variable foo(1) -onvalue on
list [catch {.m1 invoke 1} msg] $msg [catch {set foo(1)} msg2] $msg2 [catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 on 0 {}}
test menu-4.6 {TkInvokeMenu: radiobutton} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1 -tearoff 1
.m1 add radiobutton -label "1" -variable foo -value one
.m1 add radiobutton -label "2" -variable foo -value two
.m1 add radiobutton -label "3" -variable foo -value three
list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 one 0 {}}
test menu-4.7 {TkInvokeMenu: radiobutton} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1 -tearoff 1
.m1 add radiobutton -label "1" -variable foo -value one
.m1 add radiobutton -label "2" -variable foo -value two
.m1 add radiobutton -label "3" -variable foo -value three
list [catch {.m1 invoke 2} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 two 0 {}}
test menu-4.8 {TkInvokeMenu: radiobutton} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add radiobutton -label "1" -variable foo -value one
.m1 add radiobutton -label "2" -variable foo -value two
.m1 add radiobutton -label "3" -variable foo -value three
list [catch {.m1 invoke 3} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 three 0 {}}
test menu-4.9 {TkInvokeMenu: radiobutton array element} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add radiobutton -label "1" -variable foo(2) -value one
.m1 add radiobutton -label "2" -variable foo(2) -value two
.m1 add radiobutton -label "3" -variable foo(2) -value three
list [catch {.m1 invoke 3} msg] $msg [catch {set foo(2)} msg2] $msg2 [catch {unset foo} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 {} 0 three 0 {}}
test menu-4.10 {TkInvokeMenu} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add command -label "test" -command "set menu_test menu-4.8"
list [catch {.m1 invoke 1} msg] $msg [catch {set menu_test} msg2] $msg2 [catch {unset menu_test} msg3] $msg3
} -cleanup {
destroy .m1
} -result {0 menu-4.8 0 menu-4.8 0 {}}
test menu-4.11 {TkInvokeMenu} -setup {
destroy .m1
} -body {
menu .m1
.m1 add cascade -label "test" -menu .m1.m2
list [catch {.m1 invoke 1} msg] $msg
} -cleanup {
destroy .m1
} -result {0 {}}
test menu-4.12 {TkInvokeMenu} -setup {
destroy .m1
} -body {
menu .m1 -tearoff 1
.m1 add command -label "test" -command ".m1 delete 1"
list [catch {.m1 invoke 1} msg] $msg [catch {.m1 type "test"} msg2] $msg2
} -cleanup {
destroy .m1
} -result {0 {} 1 {bad menu entry index "test"}}
test menu-5.1 {DestroyMenuInstance} -setup {
destroy .m1
} -body {
menu .m1
destroy .m1
} -returnCodes ok
test menu-5.2 {DestroyMenuInstance - cascade menu} -setup {
destroy .m1 .m2
} -body {
menu .m1
.m1 add cascade -menu .m2
menu .m2
destroy .m1 .m2
} -returnCodes ok
test menu-5.3 {DestroyMenuInstance - multiple cascade parents} -setup {
destroy .m1 .m2 .m3
} -body {
menu .m1
.m1 add cascade -menu .m3
menu .m2
.m2 add cascade -menu .m3
menu .m3
list [destroy .m3] [destroy .m1 .m2]
} -returnCodes ok -result {{} {}}
test menu-5.4 {DestroyMenuInstance - multiple cascade parents} -setup {
destroy .m1 .m2 .m3 .m4
} -body {
menu .m1
.m1 add cascade -menu .m4
menu .m2
.m2 add cascade -menu .m4
menu .m3
.m3 add cascade -menu .m4
menu .m4
list [destroy .m4] [destroy .m1 .m2 .m3]
} -returnCodes ok -result {{} {}}
test menu-5.5 {DestroyMenuInstance - cascades of cloned menus} -setup {
destroy .m1 .m2
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2
. configure -menu .m1
list [destroy .m2] [.m1 entrycget 1 -menu] [. configure -menu ""] [destroy .m1]
} -returnCodes ok -result {{} .m2 {} {}}
test menu-5.6 {DestroyMenuInstance - cascades of cloned menus} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
menu .m2
. configure -menu .m1
toplevel .t2
wm geometry .t2 +0+0
.t2 configure -menu .m1
list [destroy .m2] [. configure -menu ""] [destroy .t2 .m1]
} -returnCodes ok -result {{} {} {}}
test menu-5.7 {DestroyMenuInstance - basic clones} -setup {
destroy .m1
} -body {
menu .m1
set tearoff [tk::TearOffMenu .m1]
list [destroy $tearoff] [destroy .m1]
} -result {{} {}}
test menu-5.8 {DestroyMenuInstance - multiple clones} -setup {
destroy .m1
} -body {
menu .m1
set tearoff1 [tk::TearOffMenu .m1]
set tearoff2 [tk::TearOffMenu .m1]
list [destroy $tearoff1] [destroy .m1]
} -returnCodes ok -result {{} {}}
test menu-5.9 {DestroyMenuInstace - main menu} -setup {
destroy .m1
} -body {
menu .m1
tk::TearOffMenu .m1
destroy .m1
} -returnCodes ok
test menu-5.10 {DestroyMenuInstance - freeing entries} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "foo"
destroy .m1
} -returnCodes ok
test menu-5.11 {DestroyMenuInstace - no entries} -setup {
destroy .m1
} -body {
menu .m1
.m1 configure -tearoff 0
destroy .m1
} -returnCodes ok
test menu-5.12 {DestroyMenuInstance - platform data} -setup {
destroy .m1
} -body {
menu .m1
destroy .m1
} -returnCodes ok
test menu-5.13 {DestroyMenuInstance - clones when mismatched tearoffs} -setup {
destroy .m1 .m2
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2
set tearoff [tk::TearOffMenu .m1 40 40]
list [destroy .m2] [destroy .m1]
} -result {{} {}}
test menu-6.1 {TkDestroyMenu} -setup {
destroy .m1
} -body {
menu .m1
destroy .m1
} -returnCodes ok
test menu-6.2 {TkDestroyMenu - reentrancy} -setup {
destroy .m1 .m2
} -body {
menu .m1
bind .m1 <Destroy> {destroy .m1}
menu .m2
bind .m2 <Destroy> {destroy .m2}
list [destroy .m1] [destroy .m2]
} -returnCodes ok -result {{} {}}
test menu-6.3 {TkDestroyMenu - reentrancy} -setup {
destroy .m1 .m2 .m3
} -body {
menu .m1
bind .m1 <Destroy> {destroy .m2}
.m1 clone .m2
.m1 clone .m3
list [destroy .m1] [winfo exists .m2]
} -returnCodes ok -result {{} 0}
test menu-6.4 {TkDestroyMenu - reentrancy - clones} -setup {
destroy .m1 .m2
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m1.m3
destroy .m1
} -cleanup {
deleteWindows
} -returnCodes ok
test menu-6.5 {TkDestroyMenu} -setup {
destroy .m1 .m2
} -body {
menu .m1
.m1 clone .m2
destroy .m1
winfo exists .m2
} -result 0
test menu-6.6 {TkDestroyMenu} -setup {
destroy .m1 .m2
} -body {
menu .m1
.m1 clone .m2 tearoff
destroy .m1
} -result {}
test menu-6.7 {TkDestroyMenu} -setup {
destroy .m1 .m2
} -body {
menu .m1
.m1 clone .m2
destroy .m2
destroy .m1
} -returnCodes ok -result {}
test menu-6.8 {TkDestroyMenu} -setup {
destroy .m1 .m2 .m3
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
destroy .m1
list [winfo exists .m2] [winfo exists .m3]
} -result {0 0}
test menu-6.9 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
list [destroy .m2] [destroy .m3] [destroy .m1]
} -returnCodes ok -result {{} {} {}}
test menu-6.10 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
list [destroy .m3] [destroy .m1]
} -returnCodes ok -result {{} {}}
test menu-6.11 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
.m1 clone .m4
list [destroy .m2] [destroy .m1]
} -returnCodes ok -result {{} {}}
test menu-6.12 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
.m1 clone .m4
list [destroy .m3] [destroy .m1]
} -returnCodes ok -result {{} {}}
test menu-6.13 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
.m1 clone .m4
list [destroy .m4] [destroy .m1]
} -returnCodes ok -result {{} {}}
test menu-6.14 {TkDestroyMenu} -setup {
destroy .m1
} -body {
menu .m1
. configure -menu .m1
list [destroy .m1] [. configure -menu ""]
} -returnCodes ok -result {{} {}}
test menu-6.15 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
toplevel .t2
wm geometry .t2 +0+0
. configure -menu .m1
.t2 configure -menu .m1
list [destroy .m1] [destroy .t2] [. configure -menu ""]
} -result {{} {} {}}
test menu-6.16 {TkDestroyMenu} -setup {
deleteWindows
} -body {
menu .m1
toplevel .t2
wm geometry .t2 +0+0
toplevel .t3
wm geometry .t3 +0+0
. configure -menu .m1
.t2 configure -menu .m1
.t3 configure -menu .m1
list [destroy .m1] [destroy .t2] [destroy .t3] [. configure -menu ""]
} -result {{} {} {} {}}
test menu-6.17 {TkDestroyMenu - bug 14a9b62e1d} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -command {destroy .m1}
.m1 invoke end
winfo exists .m1
} -result {0}
test menu-7.1 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
destroy .m1
} -returnCodes ok
test menu-7.2 {UnhookCascadeEntry} -setup {
destroy .m1
} -body {
menu .m1
.m1 add cascade -menu .m2
destroy .m1
} -returnCodes ok
test menu-7.3 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m2 add cascade -menu .cascade
.m1 add cascade -menu .cascade
list [destroy .m1] [destroy .m2]
} -returnCodes ok -result {{} {}}
test menu-7.4 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .cascade
.m2 add cascade -menu .cascade
list [destroy .m1] [destroy .m2]
} -returnCodes ok -result {{} {}}
test menu-7.5 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
menu .m3
.m1 add cascade -menu .cascade
.m2 add cascade -menu .cascade
.m3 add cascade -menu .cascade
list [destroy .m1] [destroy .m2 .m3]
} -returnCodes ok -result {{} {}}
test menu-7.6 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
menu .m3
.m1 add cascade -menu .cascade
.m2 add cascade -menu .cascade
.m3 add cascade -menu .cascade
list [destroy .m2] [destroy .m1 .m3]
} -returnCodes ok -result {{} {}}
test menu-7.7 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
menu .m3
.m1 add cascade -menu .cascade
.m2 add cascade -menu .cascade
.m3 add cascade -menu .cascade
list [destroy .m3] [destroy .m1 .m2]
} -returnCodes ok -result {{} {}}
test menu-7.8 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2
list [destroy .m1] [destroy .m2]
} -returnCodes ok -result {{} {}}
test menu-7.9 {UnhookCascadeEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2
destroy .m1
destroy .m2
} -returnCodes ok
test menu-8.1 {DestroyMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2
list [.m1 delete 1] [destroy .m1 .m2]
} -result {{} {}}
test menu-8.2 {DestroyMenuEntry} -setup {
deleteWindows
catch {image delete image1a}
} -body {
image create photo image1a -file $earthPhotoFile
menu .m1
.m1 add command -image image1a
list [.m1 delete 1] [destroy .m1] [image delete image1a]
} -result {{} {} {}}
test menu-8.3 {DestroyMenuEntry} -constraints testImageType -setup {
deleteWindows
imageCleanup
} -body {
image create test image1
image create test image2
menu .m1
.m1 add checkbutton -image image1 -selectimage image2
.m1 invoke 1
list [.m1 delete 1] [destroy .m1]
} -cleanup {
imageCleanup
deleteWindows
} -result {{} {}}
test menu-8.4 {DestroyMenuEntry} -setup {
destroy .m1
} -body {
menu .m1
.m1 add checkbutton -variable foo
list [.m1 delete 1] [destroy .m1]
} -result {{} {}}
test menu-8.5 {DestroyMenuEntry} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
list [.m1 delete 1] [destroy .m1]
} -result {{} {}}
test menu-8.6 {DestroyMenuEntry} -setup {
destroy .m1
} -body {
menu .m1 -tearoff 1
.m1 add command -label "one"
.m1 add command -label "two"
list [.m1 delete 1] [.m1 entrycget 1 -label] [destroy .m1]
} -result {{} two {}}
test menu-8.7 {DestroyMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "one"
.m1 clone .m2 tearoff
list [.m2 delete 1] [destroy .m1]
} -result {{} {}}
# test menu-9 - Can only change when fonts change on system, which cannot
# be done from tcl.
test menu-9.1 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand]
} -cleanup {
deleteWindows
} -result {{} beep}
test menu-9.2 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
list [.m1 configure -tearoff 0] [.m1 entrycget 1 -label]
} -cleanup {
deleteWindows
} -result {{} test}
test menu-9.3 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand]
} -cleanup {
deleteWindows
} -result {{} beep}
test menu-9.4 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -fg red
} -cleanup {
deleteWindows
} -result {}
test menu-9.5 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "two"
.m1 configure -fg red
} -cleanup {
deleteWindows
} -result {}
test menu-9.6 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "two"
.m1 add command -label "three"
.m1 configure -fg red
} -cleanup {
deleteWindows
} -result {}
test menu-9.7 {ConfigureMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2 tearoff
list [.m1 configure -fg red] [.m2 cget -fg]
} -cleanup {
deleteWindows
} -result {{} red}
test menu-9.8 {ConfigureMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2 tearoff
list [.m2 configure -fg red] [.m1 cget -fg]
} -cleanup {
deleteWindows
} -result {{} red}
test menu-9.9 {ConfigureMenu} -setup {
destroy .m1
} -body {
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-10.1 {PostProcessEntry: array variable} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
set foo(1) on
.m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
set foo(1)
} -cleanup {
deleteWindows
} -result {on}
test menu-10.2 {PostProcessEntry: array variable} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
set foo(1)
} -cleanup {
deleteWindows
} -result {off}
test menu-11.1 {ConfigureMenuEntry} -setup {
destroy .m1
} -body {
catch {unset foo}
menu .m1
.m1 add checkbutton -variable foo -onvalue on -offvalue off -label "Nonsense"
list [.m1 entryconfigure 1 -variable bar] [.m1 entrycget 1 -variable]
} -cleanup {
deleteWindows
} -result {{} bar}
test menu-11.2 {ConfigureMenuEntry} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command -label "test"
list [.m1 entryconfigure 1 -label ""] [.m1 entrycget 1 -label]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-11.3 {ConfigureMenuEntry} -setup {
destroy .m1
} -body {
menu .m1
.m1 add command
list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label]
} -cleanup {
deleteWindows
} -result {{} test}
test menu-11.4 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command
list [.m1 entryconfigure 1 -accel "S"] [.m1 entrycget 1 -accel]
} -cleanup {
deleteWindows
} -result {{} S}
test menu-11.5 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command
list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label]
} -cleanup {
deleteWindows
} -result {{} test}
test menu-11.6 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command
.m1 entryconfigure 1 -label "test"
} -cleanup {
deleteWindows
} -result {}
test menu-11.7 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m2
menu .m1
.m1 add cascade
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
deleteWindows
} -result {}
test menu-11.8 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
deleteWindows
} -result {}
test menu-11.9 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m3
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
deleteWindows
} -result {}
test menu-11.10 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
deleteWindows
} -result {}
test menu-11.11 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
.m1 entryconfigure 1 -label "test" -menu .m2
} -cleanup {
deleteWindows
} -result {}
test menu-11.12 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m2 add cascade -menu .m1
menu .m3
.m3 add cascade -menu .m1
menu .m4
.m4 add cascade -menu .m1
menu .m5
.m5 add cascade
.m5 entryconfigure 1 -label "test" -menu .m1
} -cleanup {
deleteWindows
} -result {}
test menu-11.13 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m2 add cascade -menu .m1
menu .m3
.m3 add cascade -menu .m1
menu .m4
.m4 add cascade -menu .m1
.m3 entryconfigure 1 -label "test" -menu .m1
} -cleanup {
deleteWindows
} -result {}
test menu-11.14 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add checkbutton
list [.m1 entryconfigure 1 -variable "test"] [.m1 entrycget 1 -variable]
} -cleanup {
deleteWindows
} -result {{} test}
test menu-11.15 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
list [.m1 add checkbutton -label "test"] [.m1 entrycget 1 -variable]
} -cleanup {
deleteWindows
} -result {e001 test}
test menu-11.16 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add radiobutton -label "test"
} -cleanup {
deleteWindows
} -result {e001}
test menu-11.17 {ConfigureMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add checkbutton
list [.m1 entryconfigure 1 -onvalue "test"] [.m1 entrycget 1 -onvalue]
} -cleanup {
deleteWindows
} -result {{} test}
test menu-11.18 {ConfigureMenuEntry} -constraints testImageType -setup {
deleteWindows
imageCleanup
} -body {
menu .m1
.m1 add command
image create test image1
.m1 entryconfigure 1 -image image1
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-11.19 {ConfigureMenuEntry} -constraints {
testImageType
} -setup {
deleteWindows
imageCleanup
} -body {
image create test image1
image create photo image2 -file $earthPhotoFile
menu .m1
.m1 add command -image image1
.m1 entryconfigure 1 -image image2
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-11.20 {ConfigureMenuEntry} -constraints {
testImageType
} -setup {
deleteWindows
imageCleanup
} -body {
image create photo image1 -file $earthPhotoFile
image create test image2
menu .m1
.m1 add checkbutton -image image1
.m1 entryconfigure 1 -selectimage image2
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-11.21 {ConfigureMenuEntry} -constraints {
testImageType
} -setup {
deleteWindows
imageCleanup
} -body {
image create photo image1 -file $earthPhotoFile
image create test image2
image create test image3
menu .m1
.m1 add checkbutton -image image1 -selectimage image2
.m1 entryconfigure 1 -selectimage image3
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-12.1 {ConfigureMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m2 configure -tearoff 0
.m1 clone .m3
.m1 add command -label "test"
.m1 add command -label "test2"
.m1 entryconfigure 1 -gork "foo"
} -cleanup {
deleteWindows
} -returnCodes error -result {unknown option "-gork"}
test menu-12.2 {ConfigureMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
menu .m3
.m1 add cascade -menu .m3
menu .m4
.m1 entryconfigure 1 -menu .m4
} -cleanup {
deleteWindows
} -result {}
test menu-12.3 {ConfigureMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 add cascade -label dummy
.m1 entryconfigure dummy -menu .m3
} -cleanup {
deleteWindows
} -result {}
test menu-12.4 {ConfigureMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -label File -menu .m1.foo
menu .m1.foo
.m1.foo add command -label bar
.m1 clone .m2
.m1 entryconfigure File -state disabled
} -cleanup {
deleteWindows
} -result {}
test menu-13.1 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1 -tearoff 1
.m1 add command -label "active"
.m1 add command -label "test2"
.m1 add command -label "test3"
.m1 activate 2
.m1 entrycget active -label
} -cleanup {
deleteWindows
} -result {test2}
test menu-13.2 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "last"
.m1 add command -label "test2"
.m1 add command -label "test3"
.m1 activate 2
.m1 entrycget last -label
} -cleanup {
deleteWindows
} -result {test3}
test menu-13.3 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "last"
.m1 add command -label "test2"
.m1 add command -label "test3"
.m1 activate 2
.m1 entrycget end -label
} -cleanup {
deleteWindows
} -result {test3}
test menu-13.4 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
list [.m1 insert last command -label "test2"] [.m1 entrycget last -label]
} -cleanup {
deleteWindows
} -result {e002 test2}
test menu-13.5 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
list [.m1 insert end command -label "test2"] [.m1 entrycget end -label]
} -cleanup {
deleteWindows
} -result {e002 test2}
test menu-13.6 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "active"
.m1 add command -label "test2"
.m1 add command -label "test3"
.m1 activate 2
.m1 entrycget {} -label
} -cleanup {
deleteWindows
} -result {}
#test menu-13.7 - Need to add @test here.
test menu-13.7 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1 -tearoff 1
.m1 add command -label "active"
.m1 add command -label "test2"
.m1 add command -label "test3"
.m1 entrycget 1 -label
} -cleanup {
deleteWindows
} -result {active}
test menu-13.8 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "active"
.m1 entrycget -1 -label
} -returnCodes error -result {bad menu entry index "-1"}
test menu-13.9 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2"
.m1 entrycget 999 -label
} -cleanup {
deleteWindows
} -result {test2}
test menu-13.10 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 insert 999 command -label "test"
.m1 entrycget 1 -label
} -cleanup {
deleteWindows
} -result {test}
test menu-13.11 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "1test"
.m1 entrycget 1test -label
} -cleanup {
deleteWindows
} -result {1test}
test menu-13.12 {TkGetMenuIndex} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2" -command "beep"
.m1 add command -label "test3"
.m1 entrycget test2 -command
} -cleanup {
deleteWindows
} -result {beep}
test menu-14.1 {MenuCmdDeletedProc} -setup {
deleteWindows
} -body {
menu .m1
destroy .m1
} -cleanup {
deleteWindows
} -returnCodes ok
test menu-14.2 {MenuCmdDeletedProc} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
destroy .m1
} -cleanup {
deleteWindows
} -returnCodes ok
test menu-15.1 {MenuNewEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
} -cleanup {
deleteWindows
} -result {e001}
test menu-15.2 {MenuNewEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test3"
.m1 insert 2 command -label "test2"
} -cleanup {
deleteWindows
} -result {e003}
test menu-15.3 {MenuNewEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2"
} -cleanup {
deleteWindows
} -result {e002}
test menu-15.4 {MenuNewEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.1 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 insert foo command -label "test"
} -returnCodes error -result {bad menu entry index "foo"}
test menu-16.2 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 insert test command -label "foo"
} -cleanup {
deleteWindows
} -result {e002}
test menu-16.3 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 insert -1 command -label "test"
} -returnCodes error -result {bad menu entry index "-1"}
test menu-16.4 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1 -tearoff 1
.m1 add command -label "test"
.m1 insert 0 command -label "test2"
.m1 entrycget 1 -label
} -cleanup {
deleteWindows
} -result {test2}
test menu-16.5 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.6 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add checkbutton
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.7 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.8 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add radiobutton
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.9 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add separator
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.10 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add blork
} -returnCodes error -result {bad menu entry type "blork": must be cascade, checkbutton, command, radiobutton, or separator}
test menu-16.11 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command
} -cleanup {
deleteWindows
} -result {e001}
test menu-16.12 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m2 clone .m3
list [.m2 add command -label "test"] [.m1 entrycget 1 -label] [.m3 entrycget 1 -label]
} -cleanup {
deleteWindows
} -result {e001 test test}
test menu-16.13 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m2 clone .m3
list [.m3 add command -label "test"] [.m1 entrycget 1 -label] [.m2 entrycget 1 -label]
} -cleanup {
deleteWindows
} -result {e001 test test}
test menu-16.14 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -blork fish
} -returnCodes error -result {unknown option "-blork"}
test menu-16.15 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "File"
menu .container
. configure -menu .container
list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {e001 {}}
test menu-16.16 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
set tearoff [tk::TearOffMenu .m2]
list [.m2 add cascade -menu .m1] [$tearoff unpost]
} -cleanup {
deleteWindows
} -result {e001 {}}
test menu-16.17 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
menu .container
. configure -menu .container
set tearoff [tk::TearOffMenu .container]
list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {e001 {}}
test menu-16.18 {MenuAddOrInsert} -setup {
deleteWindows
} -body {
menu .m1
menu .container
.container add cascade -menu .m1
. configure -menu .container
list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {e002 {}}
test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup {
deleteWindows
} -body {
menu .menubar
menu .menubar.test -tearoff 0
.menubar add cascade -label Test -underline 0 -menu .menubar.test
menu .menubar.test.cascade -tearoff 0
.menubar.test.cascade add command -label SubItem -command "puts SubItemSelected"
. configure -menu .menubar
list [catch {.menubar.test add cascade -label SubMenu \
-menu .menubar.test.cascade}] \
[info commands .\#menubar.\#menubar\#test.\#menubar\#test\#cascade] \
[. configure -menu ""]
} -cleanup {
deleteWindows
} -result {0 .#menubar.#menubar#test.#menubar#test#cascade {}}
test menu-17.1 {MenuVarProc} -setup {
deleteWindows
} -body {
catch {unset foo}
menu .m1
set foo "hello"
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[unset foo]
} -cleanup {
deleteWindows
} -result {e001 {}}
# menu-17.2 - Don't know how to generate the flags in the if
test menu-17.2 {MenuVarProc} -setup {
deleteWindows
} -body {
catch {unset foo}
menu .m1
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo ""]
} -cleanup {
deleteWindows
} -result {e001 {}}
test menu-17.3 {MenuVarProc} -setup {
deleteWindows
} -body {
catch {unset foo}
menu .m1
set foo "hello"
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo "hello"] [unset foo]
} -cleanup {
deleteWindows
} -result {e001 hello {}}
test menu-17.4 {MenuVarProc} -setup {
deleteWindows
} -body {
menu .m1
set foo "goodbye"
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo "hello"] [unset foo]
} -cleanup {
deleteWindows
} -result {e001 hello {}}
test menu-17.5 {MenuVarProc} -setup {
deleteWindows
} -body {
menu .m1
set foo "hello"
list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
[set foo "goodbye"] [unset foo]
} -cleanup {
deleteWindows
} -result {e001 goodbye {}}
test menu-17.6 {MenuVarProc [5d991b822e]} -setup {
deleteWindows
} -body {
# Want this not to crash
menu .b
set var INIT
.b add checkbutton -variable var
trace add variable var unset {apply {args {
.b entryconfigure 1 -variable {}
}}}
unset var
} -cleanup {
deleteWindows
} -result {}
test menu-17.7 {MenuVarProc [5d991b822e]} -setup {
deleteWindows
} -body {
# Want this not to duplicate traces
menu .b
set var INIT
.b add checkbutton -variable var
trace add variable var unset {apply {args {
.b entryconfigure 1 -variable new
}}}
unset var
} -cleanup {
deleteWindows
} -result {}
test menu-18.1 {TkActivateMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 activate 1
} -cleanup {
deleteWindows
} -result {}
test menu-18.2 {TkActivateMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 activate 0
} -cleanup {
deleteWindows
} -result {}
test menu-18.3 {TkActivateMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2"
.m1 activate 1
.m1 activate 2
} -cleanup {
deleteWindows
} -result {}
test menu-18.4 {TkActivateMenuEntry} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 add command -label "test2"
.m1 activate 1
.m1 activate 1
} -cleanup {
deleteWindows
} -result {}
test menu-19.1 {TkPostCommand} -constraints nonUnixUserInteraction -setup {
deleteWindows
} -body {
menu .m1 -postcommand "set menu_test menu-19.1"
.m1 add command -label "menu-19.1 - hit Escape"
list [.m1 post 40 40] [.m1 unpost] [set menu_test]
} -cleanup {
deleteWindows
} -result {menu-19.1 {} menu-19.1}
test menu-19.2 {TkPostCommand} -constraints nonUnixUserInteraction -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "menu-19.2 - hit Escape"
list [.m1 post 40 40] [.m1 unpost]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-20.1 {CloneMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2]
} -cleanup {
deleteWindows
} -result {}
test menu-20.2 {CloneMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2 normal
deleteWindows
} -result {}
test menu-20.3 {CloneMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2 tearoff
} -cleanup {
deleteWindows
} -result {}
test menu-20.4 {CloneMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2 menubar
} -cleanup {
deleteWindows
} -result {}
test menu-20.5 {CloneMenu} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2 foo
} -returnCodes error -result {bad menu type "foo": must be menubar, normal, or tearoff}
test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
} -cleanup {
deleteWindows
} -result {}
test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
.m1 clone .m3
} -cleanup {
deleteWindows
} -result {}
test menu-20.8 {CloneMenu - cascade entries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
.m1 clone .foo
} -cleanup {
deleteWindows
} -result {}
test menu-20.9 {CloneMenu - cascades entries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
menu .m2
.m1 clone .foo
} -cleanup {
deleteWindows
} -result {}
test menu-20.10 {CloneMenu - tearoff fields} -setup {
deleteWindows
} -body {
menu .m1 -tearoff 1
list [.m1 clone .m2 normal] [.m2 cget -tearoff]
} -cleanup {
deleteWindows
} -result {{} 1}
test menu-20.11 {CloneMenu} -setup {
deleteWindows
} -body {
menu .m1
menu .m2
.m1 clone .m2
} -returnCodes error -result {window name "m2" already exists in parent}
test menu-20.12 {CloneMenu - copied bindings on empty menu} -setup {
deleteWindows
set x {}
} -body {
menu .m1 -tearoff 0
bind .m1 <<Test>> {append x <<Test>>}
.m1 clone .m2 tearoff
.m2 post 100 100
event generate .m2 <<Test>>
return $x
} -result {<<Test>>}
test menu-20.13 {CloneMenu - copied bindings on non-empty menu} -setup {
deleteWindows
set x {}
} -body {
menu .m1 -tearoff 1
bind .m1 <<Test>> {append x <<Test>>}
.m1 clone .m2 tearoff
.m2 post 100 100
event generate .m2 <<Test>>
return $x
} -result {<<Test>>}
test menu-20.14 {CloneMenu - new binding on empty menu} -setup {
deleteWindows
set x {}
} -body {
menu .m1 -tearoff 0
.m1 clone .m2 tearoff
.m2 post 100 100
bind .m1 <<Test>> {append x <<Test>>}
event generate .m2 <<Test>>
return $x
} -result {<<Test>>}
test menu-20.15 {CloneMenu - new binding on non-empty menu} -setup {
deleteWindows
set x {}
} -body {
menu .m1 -tearoff 1
.m1 clone .m2 tearoff
.m2 post 100 100
bind .m1 <<Test>> {append x <<Test>>}
event generate .m2 <<Test>>
return $x
} -result {<<Test>>}
test menu-20.16 {CloneMenu - bindtags} -setup {
deleteWindows
} -body {
menu .m1
bindtags .m1 [linsert [bindtags .m1] 1 .m1.sub1]
.m1 clone .m2
bindtags .m2
} -result {.m2 .m1 .m1.sub1 Menu all}
test menu-21.1 {MenuDoYPosition} -setup {
deleteWindows
} -body {
menu .m1
.m1 yposition glorp
} -returnCodes error -result {bad menu entry index "glorp"}
test menu-21.2 {MenuDoYPosition} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "Test"
.m1 yposition 1
} -cleanup {
deleteWindows
} -returnCodes ok -match glob -result {*}
test menu-22.1 {GetIndexFromCoords} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
.m1 index @5
} -cleanup {
deleteWindows
} -result 0
test menu-22.2 {GetIndexFromCoords} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
.m1 index @5,5
} -cleanup {
deleteWindows
} -result 0
test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
deleteWindows
} -constraints {x11} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
tk_popup .m1 0 0
tkwait visibility .m1
.m1 index @5
} -cleanup {
deleteWindows
} -result 0
test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
deleteWindows
} -constraints {x11} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
tk_popup .m1 0 0
tkwait visibility .m1
update
set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
.m1 index @$x,5
} -cleanup {
deleteWindows
} -result 0
test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
deleteWindows
} -constraints {x11} -body {
menu .m1
.m1 add command -label "test"
.m1 configure -tearoff 0
tk_popup .m1 0 0
tkwait visibility .m1
wm geometry .m1 200x100
update
set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
.m1 index @$x,5
} -cleanup {
deleteWindows
} -result 0
test menu-22.6 {GetIndexFromCoords: syntax error in @x,y indices} -setup {
deleteWindows
} -body {
menu .m
.m add command -label "First entry"
.m add command -label "Second entry"
.m add command -label "Last entry"
.m index @4bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {bad menu entry index "@4bogus"}
test menu-22.7 {GetIndexFromCoords: syntax error in @x,y indices} -setup {
deleteWindows
} -body {
menu .m
.m add command -label "First entry"
.m add command -label "Second entry"
.m add command -label "Last entry"
.m index @10,4bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {bad menu entry index "@10,4bogus"}
test menu-22.8 {GetIndexFromCoords: syntax error in @x,y indices} -setup {
deleteWindows
} -body {
menu .m
.m add command -label "First entry"
.m add command -label "Second entry"
.m add command -label "Last entry"
.m index @10,bogus
} -cleanup {
deleteWindows
} -returnCodes error -result {bad menu entry index "@10,bogus"}
test menu-22.9 {GetIndexFromCoords: index type pecedence} -setup {
deleteWindows
} -body {
menu .m -tearoff 0
.m add command -label "First entry"
.m add command -label "@42nd street"
.m add command -label "Last entry"
.m index "@42nd*" ; # shall be interpreted as a pattern, not as @42
} -cleanup {
deleteWindows
} -result {1}
test menu-22.10 {tk_popup on separator entry} -setup {
deleteWindows
} -constraints {x11} -body {
menu .m1
label .l -text ClickMe!
.m1 add command -label "Example 1" -command bell
.m1 add command -label "Example 2" -command bell
.m1 add separator
.m1 add command -label "Example Other" -command "bell;bell"
tk_popup .m1 100 100 2
set waiting 0
tkwait visibility .m1
after 333 incr waiting
vwait waiting
.m1 invoke 4
after 333 incr waiting
vwait waiting
destroy .m1
} -cleanup {
deleteWindows
} -result {}
test menu-23.1 {RecursivelyDeleteMenu} -setup {
deleteWindows
} -body {
menu .m1
. configure -menu .m1
. configure -menu ""
} -cleanup {
deleteWindows
} -result {}
test menu-23.2 {RecursivelyDeleteMenu} -setup {
deleteWindows
} -body {
menu .m2
.m2 add command -label "test2"
menu .m1
.m1 add cascade -label "test1" -menu .m2
. configure -menu .m1
. configure -menu ""
} -cleanup {
deleteWindows
} -result {}
test menu-24.1 {TkNewMenuName} -setup {
deleteWindows
} -body {
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-24.2 {TkNewMenuName} -setup {
deleteWindows
} -body {
menu .m1
menu .m1\#0
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-24.3 {TkNewMenuName} -setup {
deleteWindows
} -body {
menu .#m
rename .#m hideme
list [catch {. configure -menu [menu .m]}] [. configure -menu ""] [destroy .#m] \
[destroy .m] [destroy hideme]
} -result {0 {} {} {} {}}
test menu-25.1 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.2 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.3 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
destroy .m1
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.4 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
. configure -menu .m1
menu .m2
list [. configure -menu .m2] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.5 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
. configure -menu .m1
.m1 clone .m2
menu .m3
list [. configure -menu .m3] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.6 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
.m1 clone .m2
. configure -menu .m2
menu .m3
list [. configure -menu .m3] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.7 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
menu .m2
. configure -menu .m1
toplevel .t2
.t2 configure -menu .m1
list [.t2 configure -menu .m2] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.8 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
menu .m2
. configure -menu .m1
toplevel .t2
wm geometry .t2 +0+0
.t2 configure -menu .m1
list [. configure -menu .m2] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.9 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
menu .m2
. configure -menu .m1
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
list [.t3 configure -menu .m2] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.10 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
menu .m2
. configure -menu .m1
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
list [.t2 configure -menu .m2] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.11 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
menu .m2
. configure -menu .m1
toplevel .t2 -menu .m1
wm geometry .t2 +0+0
toplevel .t3 -menu .m1
wm geometry .t3 +0+0
list [. configure -menu .m2] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.12 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.13 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.14 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.15 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-25.16 {Tk_SetWindowMenubar} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
. configure -menu .m1
list [toplevel .t2 -menu m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {.t2 {}}
test menu-26.1 {DestroyMenuHashTable} -setup {
catch {interp delete testinterp}
deleteWindows
} -body {
interp create testinterp
load {} Tk testinterp
interp eval testinterp {menu .m1}
interp delete testinterp
} -returnCodes ok -result {}
test menu-27.1 {GetMenuHashTable} -setup {
catch {interp delete testinterp}
deleteWindows
} -body {
interp create testinterp
load {} Tk testinterp
list [catch {interp eval testinterp {menu .m1}} msg] $msg [interp delete testinterp]
} -cleanup {
deleteWindows
} -result {0 .m1 {}}
test menu-28.1 {TkCreateMenuReferences - not there before} -setup {
deleteWindows
} -body {
menu .m1
} -cleanup {
deleteWindows
} -result {.m1}
test menu-28.2 {TkCreateMenuReferences - there already} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m2
menu .m2
} -cleanup {
deleteWindows
} -result {.m2}
test menu-29.1 {TkFindMenuReferences - not there} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
.m1 add cascade -menu .m2
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-30.1 {TkFindMenuReferences - there already} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
menu .m2
.m1 add cascade -menu .m2
list [. configure -menu .m1] [. configure -menu ""]
} -cleanup {
deleteWindows
} -result {{} {}}
test menu-31.1 {TkFreeMenuReferences - menuPtr} -setup {
deleteWindows
} -body {
menu .m1
destroy .m1
} -cleanup {
deleteWindows
} -result {}
test menu-31.2 {TkFreeMenuReferences - cascadePtr} -setup {
deleteWindows
} -body {
. configure -menu ""
menu .m1
.m1 add cascade -menu .m2
.m1 entryconfigure 1 -menu .m3
} -cleanup {
deleteWindows
} -result {}
test menu-31.3 {TkFreeMenuReferences - topLevelListPtr} -setup {
deleteWindows
} -body {
. configure -menu .m1
. configure -menu ""
} -cleanup {
deleteWindows
} -returnCodes ok -result {}
test menu-31.4 {TkFreeMenuReferences - not empty} -setup {
deleteWindows
} -body {
menu .m1
.m1 add cascade -menu .m3
menu .m2
.m2 add cascade -menu .m3
.m2 entryconfigure 1 -menu ".foo"
} -cleanup {
deleteWindows
} -result {}
test menu-32.1 {DeleteMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label foo
.m1 clone .m2
.m1 delete 1
} -cleanup {
deleteWindows
} -result {}
test menu-32.2 {DeleteMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label one
.m1 add command -label two
.m1 add command -label three
.m1 add command -label four
.m1 clone .m2
.m1 delete 2 3
} -cleanup {
deleteWindows
} -result {}
test menu-32.3 {DeleteMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1 -tearoff 0
.m1 add command -label one
.m1 add command -label two
.m1 add command -label three
.m1 add command -label four
.m1 clone .m2
.m2 configure -tearoff 1
.m1 delete 1 2
} -cleanup {
deleteWindows
} -result {}
test menu-32.4 {DeleteMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label one
.m1 add command -label two
.m1 add command -label three
.m1 add command -label four
.m1 clone .m2
.m2 configure -tearoff 0
.m1 delete 2 3
} -cleanup {
deleteWindows
} -result {}
test menu-32.5 {DeleteMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label one
.m1 add command -label two
.m1 clone .m2
.m1 activate one
.m1 delete one
} -cleanup {
deleteWindows
} -result {}
test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} -setup {
deleteWindows
} -body {
menu .m1
.m1 add command -label test \
-command ".m1 delete test ; .m1 add command -label test -command \".m1 delete test\"; .m1 delete test"
.m1 invoke test
} -cleanup {
deleteWindows
} -result {}
test menu-32.7 {DeleteMenuCloneEntries - one entry} -setup {
deleteWindows
} -body {
menu .m1 -tearoff 0
.m1 add command -label Hello
.m1 delete Hello
} -cleanup {
deleteWindows
} -result {}
test menu-32.8 {Ensure all menu clone commands are deleted} -setup {
deleteWindows
} -body {
# SF bug #465324
menu .menubar
. configure -menu .menubar
menu .menubar.test
.menubar.test add command -label "hi"
for {set i 0} {$i < 10} {incr i} {
.menubar add cascade -menu .menubar.test -label "Test"
.menubar delete Test
}
info commands .#menubar*test*
} -cleanup {
deleteWindows
} -result {}
test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup {
set res {}
deleteWindows
} -body {
menu .menubar
. configure -menu .menubar
menu .menubar.test
.menubar add cascade -menu .menubar.test -label "Test"
menu .menubar.cascade
.menubar.test add cascade -menu .menubar.cascade -label "Cascade"
lappend res [.menubar.test entrycget 1 -menu]
lappend res [.#menubar.#menubar#test entrycget 1 -menu]
destroy .menubar.test
menu .menubar.test
.menubar.test add cascade -menu .menubar.cascade -label "Cascade"
lappend res [.menubar.test entrycget 1 -menu]
lappend res [.#menubar.#menubar#test entrycget 1 -menu]
return $res
} -cleanup {
deleteWindows
} -result {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade}
test menu-33.1 {menu vs command hiding} -setup {
deleteWindows
} -body {
set l [interp hidden]
menu .m
interp hide {} .m
destroy .m
set result [list [winfo children .] [interp hidden]]
expr {$result eq [list {} $l]}
} -result 1
# menu-34 MenuInit only called at boot time
# creating menus on two different screens then deleting the
# menu from the first screen crashes Tk8.3.1
#
test menu-34.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} -constraints {
altDisplay
} -setup {
deleteWindows
} -body {
toplevel .one
menu .one.m
toplevel .two -screen $::env(TK_ALT_DISPLAY)
menu .two.m
destroy .one
destroy .two
} -result {}
test menu-35.1 {menu -underline string overruns Bug 1599877} -setup {
destroy .m
} -body {
# ensure that -underline does not do string overruns [Bug 1599877]
menu .m
.m add command -label "File" -underline [expr {1<<30}]
. configure -menu .m
update
tk::TraverseToMenu . "e"
} -cleanup {
deleteWindows
} -result {}
test menu-37.1 {menubar menues cannot be posted - bug 2160206} -setup {
catch {destroy .m}
} -body {
# On Linux the following used to panic
# It now returns an error (on all platforms)
menu .m -type menubar
list [catch ".m post 1 1" msg] $msg
} -cleanup {
destroy .m
} -result {1 {a menubar menu cannot be posted}}
test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over it - bug fa32290898} -setup {
} -constraints {x11} -body {
toplevel .top
ttk::menubutton .top.mb -text "Some menu";
menu .top.mb.m;
.top.mb.m add command -label "Item 1";
.top.mb.m add command -label "Item 2";
.top.mb configure -menu .top.mb.m;
pack .top.mb
update
# simulate mouse click on the menubutton, which posts its menu
event generate .top.mb <Button-1> -warp 1
controlPointerWarpTiming
event generate .top.mb <ButtonRelease-1>
update
# simulate mouse click on the menu again, i.e. without
# entering/leaving the posted menu
event generate .top.mb <Button-1>
update
after 50
event generate .top.mb <ButtonRelease-1>
update
# the menu shall have been unposted by the second click
winfo ismapped .top.mb.m
} -cleanup {
destroy .top.mb.m .top.m .top
} -result 0
test menu-39.1 {empty -type - bug be8f5b9fc2} -setup {
catch {destroy .m}
} -body {
menu .m -type {}
} -cleanup {
destroy .m
} -returnCodes error -result {ambiguous type "": must be menubar, normal, or tearoff}
test menu-39.2 {use-after-free fix - bug 1797555fff} -setup {
toplevel .t
menu .t.menubar -type menubar
menu .t.menubar.select -title Select
menu .t.menubar.select.chain -title Chain
.t.menubar.select insert 1 cascade -menu .t.menubar.select.chain -label Chain
.t.menubar add cascade -menu .t.menubar.select -label Select
.t configure -menu .t.menubar
.t.menubar.select.chain insert 1 command
update idletasks
} -body {
# The following two lines caused Tk to read from and write to freed memory
destroy .t.menubar.select.chain
.t.menubar.select delete 1
} -cleanup {
destroy .t
} -result {}
test menu-40.1 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup {
} -constraints {testpressbutton} -body {
set done false
event generate {} <Motion> -x 100 -y 100
toplevel .t
menu .t.m
.t.m add command -command {puts Marco} -label Marco
.t.m add command -command {puts Polo} -label Polo
after 1000 {.t.m post 500 500}
after 2000 {destroy .t}
after 2500 {testpressbutton 530 510}
after 3000 {set done true}
tkwait variable done
}
test menu-40.2 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup {
} -constraints {testmovemouse} -body {
set done false
event generate {} <Motion> -x 100 -y 100
toplevel .t
menu .t.m
.t.m add command -command {puts Marco} -label Marco
.t.m add command -command {puts Polo} -label Polo
after 1000 {.t.m post 500 500}
after 2000 {testmovemouse 530 510}
after 3000 {destroy .t}
after 3500 {testmovemouse 530 530}
after 4000 testpressbutton 530 530
after 4500 {set done true}
tkwait variable done
testpressbutton 530 510
}
test menu-41.1 {identifiers - auto generated} -setup {
destroy .m
} -body {
menu .m
list [.m add command -label 1] [.m add command -label 2] [.m add command -label 3]
} -cleanup {
destroy .m
} -result {e001 e002 e003}
test menu-41.2 {identifiers - out of sequence} -setup {
destroy .m
} -body {
menu .m -tearoff 0
.m add command -label 1
.m insert 0 command -label 2
.m add command -label 3
list [.m index e001] [.m index e002] [.m index e003]
} -cleanup {
destroy .m
} -result {1 0 2}
test menu-41.3 {identifiers - out of sequence with tearoff} -setup {
destroy .m
} -body {
menu .m -tearoff 1
.m add command -label 1
.m insert 0 command -label 2
.m add command -label 3
list [.m index e001] [.m index e002] [.m index e003]
} -cleanup {
destroy .m
} -result {2 1 3}
test menu-41.4 {identifiers - entry id} -setup {
destroy .m
} -body {
menu .m -tearoff 1
.m add command -label 1
.m insert 0 command -label 2
.m add command -label 3
list [.m id 0] [.m id 1] [.m id 2] [.m id 3]
} -cleanup {
destroy .m
} -result {{} e002 e001 e003}
test menu-41.5 {identifiers - assigned} -setup {
destroy .m
} -body {
menu .m
list [.m add command cmd1 -label 1] [.m insert 0 command cmd2 -label 2] [.m add command cmd3 -label 3]
} -cleanup {
destroy .m
} -result {cmd1 cmd2 cmd3}
test menu-41.6 {identifiers - mixed} -setup {
destroy .m
} -body {
menu .m
list [.m add command -label 1] [.m insert 0 command cmd2 -label 2] [.m add command -label 3]
} -cleanup {
destroy .m
} -result {e001 cmd2 e002}
test menu-41.7 {identifiers - conflict} -setup {
destroy .m
} -body {
menu .m
list [.m add command e002 -label 1] [.m add command -label 2] [.m add command -label 3]
} -cleanup {
destroy .m
} -result {e002 e001 e003}
test menu-41.8 {identifiers - clone of complete menu} -setup {
destroy .m1 .m2
} -body {
menu .m1 -tearoff 0
.m1 add command -label 1
.m1 insert 0 command -label 2
.m1 add command cmd3 -label 3
.m1 clone .m2
list [.m2 index e001] [.m2 index e002] [.m2 index cmd3]
} -cleanup {
destroy .m1 .m2
} -result {1 0 2}
test menu-41.9 {identifiers - modify after cloning} -setup {
destroy .m1 .m2
} -body {
menu .m1 -tearoff 0
.m1 clone .m2
.m1 add command -label 1
.m1 insert 0 command -label 2
.m1 add command cmd3 -label 3
list [.m2 index e001] [.m2 index e002] [.m2 index cmd3]
} -cleanup {
destroy .m1 .m2
} -result {1 0 2}
test menu-41.10 {identifiers - modify clone} -setup {
destroy .m1 .m2
} -body {
menu .m1 -tearoff 0
.m1 clone .m2
.m2 add command -label 1
.m2 insert 0 command -label 2
.m2 add command cmd3 -label 3
list [.m1 index e001] [.m1 index e002] [.m1 index cmd3]
} -cleanup {
destroy .m1 .m2
} -result {1 0 2}
test menu-41.11 {identifiers - entrycget by id} -setup {
destroy .m
} -body {
menu .m
.m add command -label 1
.m add command -label 2
.m add command cmd3 -label 3
list [.m entrycget e001 -label] [.m entrycget e002 -label] [.m entrycget cmd3 -label]
} -cleanup {
destroy .m
} -result {1 2 3}
test menu-41.12 {identifiers - delete by id} -setup {
destroy .m
} -body {
menu .m
.m add command -label 1
.m add command -label 2
.m add command -label 3
.m add command -label 4
.m add command -label 5
.m add command -label 6
.m add command -label 7
.m add command cmd8 -label 8
.m add command cmd9 -label 9
.m delete e003 cmd8
list [.m id 0] [.m id 1] [.m id 2]
} -cleanup {
destroy .m
} -result {e001 e002 cmd9}
test menu-41.13 {identifiers - duplicate} -setup {
destroy .m
} -body {
menu .m
.m add command foo -label 1
.m add command bar -label 2
.m add command foo -label 3
} -cleanup {
destroy .m
} -returnCodes error -result {entry "foo" already exists}
test menu-41.14 {identifiers - reserved word} -setup {
destroy .m
} -body {
menu .m -tearoff 0
.m add command last -label 1
.m add command -label 2
.m add command -label 3
.m index last
} -cleanup {
destroy .m
} -result {2}
#
# TESTFILE CLEANUP
#
unset earthPhotoFile
imageFinish
deleteWindows
testutils forget image
cleanupTests
# Local variables:
# mode: tcl
# End:
|